Merge pull request #5931 from k9mail/remove_notifications_on_action

Remove notification when message is marked as read or deleted
This commit is contained in:
cketti 2022-02-22 20:23:29 +01:00 committed by GitHub
commit 37e406ab50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);