Postpone deleting drafts

This commit is contained in:
M66B 2023-01-27 11:39:50 +01:00
parent 5cfbeafa82
commit 39acde4025
1 changed files with 7 additions and 3 deletions

View File

@ -6477,9 +6477,6 @@ public class FragmentCompose extends FragmentBase {
}
} else if (action == R.id.action_send) {
// Delete draft (cannot move to outbox)
EntityOperation.queue(context, draft, EntityOperation.DELETE);
EntityFolder outbox = db.folder().getOutbox();
if (outbox == null) {
Log.w("Outbox missing");
@ -6499,6 +6496,8 @@ public class FragmentCompose extends FragmentBase {
draft.received = draft.ui_snoozed;
// Copy message to outbox
long did = draft.id;
draft.id = null;
draft.folder = outbox.id;
draft.uid = null;
@ -6515,6 +6514,11 @@ public class FragmentCompose extends FragmentBase {
if (draft.ui_snoozed == null)
EntityOperation.queue(context, draft, EntityOperation.SEND);
// Delete draft (cannot move to outbox)
EntityMessage tbd = db.message().getMessage(did);
if (tbd != null)
EntityOperation.queue(context, tbd, EntityOperation.DELETE);
final String feedback;
if (draft.ui_snoozed == null) {
boolean suitable = ConnectionHelper.getNetworkState(context).isSuitable();