From 21ad47d30c50866ac9087267601ff9b0140adf00 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 5 Mar 2023 08:49:58 +0100 Subject: [PATCH] Prevent trashing conversation when trashing draft --- app/src/main/java/eu/faircode/email/FragmentMessages.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 8739c499d9..1dbc2d9cbe 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -3310,6 +3310,9 @@ public class FragmentMessages extends FragmentBase EntityAccount sourceAccount = db.account().getAccount(message.account); if (sourceAccount == null) return result; + EntityFolder baseFolder = db.folder().getFolder(message.folder); + if (baseFolder == null) + return result; EntityFolder targetFolder = db.folder().getFolder(tid); if (targetFolder == null) @@ -3322,7 +3325,8 @@ public class FragmentMessages extends FragmentBase List messages = db.message().getMessagesByThread( message.account, message.thread, threading && thread ? null : id, - EntityFolder.TRASH.equals(targetFolder.type) ? null : message.folder); + !EntityFolder.DRAFTS.equals(baseFolder.type) && + EntityFolder.TRASH.equals(targetFolder.type) ? null : message.folder); for (EntityMessage threaded : messages) { EntityFolder sourceFolder = db.folder().getFolder(threaded.folder); if (sourceFolder == null ||