From da9c2062d43af9898a00489bdfaa7b06ec1f0d6a Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 29 Jan 2019 10:15:30 +0000 Subject: [PATCH] Mark seen on snooze --- .../eu/faircode/email/FragmentMessages.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 84883ccf5f..e963f8c09d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1061,16 +1061,25 @@ public class FragmentMessages extends FragmentBase { wakeup = null; DB db = DB.getInstance(context); - for (long id : ids) { - EntityMessage message = db.message().getMessage(id); - if (message != null) { - List messages = db.message().getMessageByThread( - message.account, message.thread, threading ? null : id, message.folder); - for (EntityMessage threaded : messages) { - db.message().setMessageSnoozed(threaded.id, wakeup); - EntityMessage.snooze(context, threaded.id, wakeup); + try { + db.beginTransaction(); + + for (long id : ids) { + EntityMessage message = db.message().getMessage(id); + if (message != null) { + List messages = db.message().getMessageByThread( + message.account, message.thread, threading ? null : id, message.folder); + for (EntityMessage threaded : messages) { + db.message().setMessageSnoozed(threaded.id, wakeup); + EntityMessage.snooze(context, threaded.id, wakeup); + EntityOperation.queue(context, db, threaded, EntityOperation.SEEN, true); + } } } + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); } return null;