From 1675ccd62e42cbb5b1d4c6b2dc216b3ad82551e0 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 24 Jun 2019 13:16:32 +0200 Subject: [PATCH] Fixed autoread on move from/to drafts --- app/src/main/java/eu/faircode/email/Core.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 7f619df443..e5b6644a9a 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -581,10 +581,6 @@ class Core { if (imessage == null) throw new MessageRemovedException(); - // Auto read - if (autoread && ifolder.getPermanentFlags().contains(Flags.Flag.SEEN)) - imessage.setFlag(Flags.Flag.SEEN, true); - // Get target folder EntityFolder target = db.folder().getFolder(id); if (target == null) @@ -606,10 +602,21 @@ class Core { file.delete(); + // Auto read + if (autoread) + icopy.setFlag(Flags.Flag.SEEN, true); + + // Set drafts flag icopy.setFlag(Flags.Flag.DRAFT, EntityFolder.DRAFTS.equals(target.type)); + itarget.appendMessages(new Message[]{icopy}); - } else + } else { + // Auto read + if (autoread && ifolder.getPermanentFlags().contains(Flags.Flag.SEEN)) + imessage.setFlag(Flags.Flag.SEEN, true); + ifolder.copyMessages(new Message[]{imessage}, itarget); + } // Delete source if (!copy) {