fix(badge): show badge when mentioned even if channel is muted

Fixes #8723
This commit is contained in:
Jonathan Rainville 2022-12-09 11:42:11 -05:00
parent 9825a48eec
commit 9067cc408c
1 changed files with 5 additions and 5 deletions

View File

@ -719,18 +719,18 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI
let chatDetails = self.controller.getChatDetails(chatIdMsgBelongsTo) let chatDetails = self.controller.getChatDetails(chatIdMsgBelongsTo)
if (chatDetails.muted):
# No need to update the badge nor send a notification
return
# Badge notification # Badge notification
let messageBelongsToActiveSection = sectionIdMsgBelongsTo == self.controller.getMySectionId() and let messageBelongsToActiveSection = sectionIdMsgBelongsTo == self.controller.getMySectionId() and
self.controller.getMySectionId() == self.delegate.getActiveSectionId() self.controller.getMySectionId() == self.delegate.getActiveSectionId()
let messageBelongsToActiveChat = self.controller.getActiveChatId() == chatIdMsgBelongsTo let messageBelongsToActiveChat = self.controller.getActiveChatId() == chatIdMsgBelongsTo
if(not messageBelongsToActiveSection or not messageBelongsToActiveChat): 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) self.updateBadgeNotifications(chatIdMsgBelongsTo, hasUnreadMessages, unviewedMentionsCount)
if (chatDetails.muted):
# No need to update the badge nor send a notification
return
# Prepare notification # Prepare notification
let myPK = singletonInstance.userProfile.getPubKey() let myPK = singletonInstance.userProfile.getPubKey()
var notificationType = notification_details.NotificationType.NewMessage var notificationType = notification_details.NotificationType.NewMessage