From 92fc1349f02da26e54a910f840f8a10c848b646d Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 15 Aug 2018 10:49:12 +0000 Subject: [PATCH] Mark only synchronized messages seen Skip drafts and outbox --- app/src/main/java/eu/faircode/email/ActivityView.java | 4 ++-- app/src/main/java/eu/faircode/email/FragmentMessage.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index b5f82b96..164f6990 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -521,8 +521,8 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack EntityMessage message = db.message().getMessage(id); EntityFolder folder = db.folder().getFolder(message.folder); - if (!EntityFolder.OUTBOX.equals(folder.type)) - for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) { + for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) + if (message.uid != null) { // Skip drafts and outbox db.message().setMessageUiSeen(tmessage.id, true); EntityOperation.queue(db, tmessage, EntityOperation.SEEN, true); diff --git a/app/src/main/java/eu/faircode/email/FragmentMessage.java b/app/src/main/java/eu/faircode/email/FragmentMessage.java index d2a46879..6c599c4f 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessage.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessage.java @@ -414,11 +414,12 @@ public class FragmentMessage extends FragmentEx { db.beginTransaction(); EntityMessage message = db.message().getMessage(id); - for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) { - db.message().setMessageUiSeen(tmessage.id, !message.ui_seen); + for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) + if (message.uid != null) { // Skip drafts and outbox + db.message().setMessageUiSeen(tmessage.id, !message.ui_seen); - EntityOperation.queue(db, tmessage, EntityOperation.SEEN, !tmessage.ui_seen); - } + EntityOperation.queue(db, tmessage, EntityOperation.SEEN, !tmessage.ui_seen); + } db.setTransactionSuccessful(); } finally {