Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 37e406ab authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #5931 from k9mail/remove_notifications_on_action

Remove notification when message is marked as read or deleted
parents 504062a5 e1c43bee
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1167,6 +1167,10 @@ public class MessagingController {
                l.folderStatusChanged(account, folderId);
            }

            if (flag == Flag.SEEN && newState) {
                cancelNotificationsForMessages(account, folderId, uids);
            }

            if (accountSupportsFlags) {
                LocalFolder localFolder = localStore.getFolder(folderId);
                try {
@@ -1183,6 +1187,13 @@ public class MessagingController {
        }
    }

    private void cancelNotificationsForMessages(Account account, long folderId, List<String> uids) {
        for (String uid : uids) {
            MessageReference messageReference = new MessageReference(account.getUuid(), folderId, uid);
            notificationController.removeNewMailNotification(account, messageReference);
        }
    }

    /**
     * Set or remove a flag for a set of messages in a specific folder.
     * <p>
@@ -2050,6 +2061,8 @@ public class MessagingController {
            List<LocalMessage> syncedMessages = new ArrayList<>();
            List<String> syncedMessageUids = new ArrayList<>();
            for (LocalMessage message : messages) {
                notificationController.removeNewMailNotification(account, message.makeMessageReference());

                String uid = message.getUid();
                if (uid.startsWith(K9.LOCAL_UID_PREFIX)) {
                    localOnlyMessages.add(message);