From 39acde40251f262f45474017c292896f3423f616 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 27 Jan 2023 11:39:50 +0100 Subject: [PATCH] Postpone deleting drafts --- .../main/java/eu/faircode/email/FragmentCompose.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 12666cb9c2..d4bf5ac622 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -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();