From e0a446a8a92438c3dd8636f30ff7fa78216b5ec7 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 25 Jul 2019 07:58:19 +0200 Subject: [PATCH] Check threads for multiple selection actions --- .../eu/faircode/email/FragmentMessages.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 66b0d6e2ea..6c840284ef 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1531,15 +1531,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. if (!result.folders.contains(message.folder)) result.folders.add(message.folder); - if (message.ui_seen) - result.seen = true; - else - result.unseen = true; + List messages = db.message().getMessageByThread( + message.account, message.thread, threading ? null : id, null); + for (EntityMessage threaded : messages) { + if (threaded.ui_seen) + result.seen = true; + else + result.unseen = true; - if (message.ui_flagged) - result.flagged = true; - else - result.unflagged = true; + if (threaded.ui_flagged) + result.flagged = true; + else + result.unflagged = true; + } EntityFolder folder = db.folder().getFolder(message.folder); boolean isArchive = EntityFolder.ARCHIVE.equals(folder.type); @@ -1697,9 +1701,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. for (long id : ids) { EntityMessage message = db.message().getMessage(id); - if (message != null && message.ui_seen != seen) { + if (message != null) { List messages = db.message().getMessageByThread( - message.account, message.thread, threading ? null : id, message.folder); + message.account, message.thread, threading ? null : id, null); for (EntityMessage threaded : messages) EntityOperation.queue(context, threaded, EntityOperation.SEEN, seen); } @@ -1754,7 +1758,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. EntityMessage message = db.message().getMessage(id); if (message != null) { List messages = db.message().getMessageByThread( - message.account, message.thread, threading ? null : id, message.folder); + message.account, message.thread, threading ? null : id, null); for (EntityMessage threaded : messages) EntityOperation.queue(context, threaded, EntityOperation.FLAG, flagged, color); }