From 9067cc408c39590c0a2babcc5030ef2ec079dcee Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 9 Dec 2022 11:42:11 -0500 Subject: [PATCH] fix(badge): show badge when mentioned even if channel is muted Fixes #8723 --- src/app/modules/main/chat_section/module.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index aa141812e6..c1ff5476ec 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -719,18 +719,18 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI let chatDetails = self.controller.getChatDetails(chatIdMsgBelongsTo) - if (chatDetails.muted): - # No need to update the badge nor send a notification - return - # Badge notification let messageBelongsToActiveSection = sectionIdMsgBelongsTo == self.controller.getMySectionId() and self.controller.getMySectionId() == self.delegate.getActiveSectionId() let messageBelongsToActiveChat = self.controller.getActiveChatId() == chatIdMsgBelongsTo if(not messageBelongsToActiveSection or not messageBelongsToActiveChat): - let hasUnreadMessages = unviewedMessagesCount > 0 + let hasUnreadMessages = (not chatDetails.muted and unviewedMessagesCount > 0) or unviewedMentionsCount > 0 self.updateBadgeNotifications(chatIdMsgBelongsTo, hasUnreadMessages, unviewedMentionsCount) + if (chatDetails.muted): + # No need to update the badge nor send a notification + return + # Prepare notification let myPK = singletonInstance.userProfile.getPubKey() var notificationType = notification_details.NotificationType.NewMessage