fix(chat-badge): don't count unread messages when restarting

Fixes #8943
This commit is contained in:
Jonathan Rainville 2023-01-04 13:29:30 -05:00
parent 4a5c439160
commit 297280c467
3 changed files with 6 additions and 4 deletions

View File

@ -137,7 +137,7 @@ proc buildChatSectionUI(
continue continue
let hasNotification = not chatDto.muted and (chatDto.unviewedMessagesCount > 0 or chatDto.unviewedMentionsCount > 0) let hasNotification = not chatDto.muted and (chatDto.unviewedMessagesCount > 0 or chatDto.unviewedMentionsCount > 0)
let notificationsCount = if (chatDto.muted): 0 else: chatDto.unviewedMentionsCount let notificationsCount = chatDto.unviewedMentionsCount
var chatName = chatDto.name var chatName = chatDto.name
var chatImage = "" var chatImage = ""

View File

@ -325,7 +325,8 @@ proc getNumOfNotificaitonsForChat*(self: Controller): tuple[unviewed:int, mentio
if(chat.chatType == ChatType.CommunityChat): if(chat.chatType == ChatType.CommunityChat):
continue continue
result.unviewed += chat.unviewedMessagesCount if not chat.muted:
result.unviewed += chat.unviewedMessagesCount
result.mentions += chat.unviewedMentionsCount result.mentions += chat.unviewedMentionsCount
proc getNumOfNotificationsForCommunity*(self: Controller, communityId: string): tuple[unviewed:int, mentions:int] = proc getNumOfNotificationsForCommunity*(self: Controller, communityId: string): tuple[unviewed:int, mentions:int] =
@ -336,7 +337,8 @@ proc getNumOfNotificationsForCommunity*(self: Controller, communityId: string):
if(chat.communityId != communityId): if(chat.communityId != communityId):
continue continue
result.unviewed += chat.unviewedMessagesCount if not chat.muted:
result.unviewed += chat.unviewedMessagesCount
result.mentions += chat.unviewedMentionsCount result.mentions += chat.unviewedMentionsCount
proc setCurrentUserStatus*(self: Controller, status: StatusType) = proc setCurrentUserStatus*(self: Controller, status: StatusType) =

View File

@ -223,7 +223,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
mentionsCount = mentionsCount + receivedContactRequests.len mentionsCount = mentionsCount + receivedContactRequests.len
let hasNotification = unviewedCount > 0 or mentionsCount > 0 let hasNotification = unviewedCount > 0 or mentionsCount > 0
let notificationsCount = mentionsCount # we need to add here number of requests let notificationsCount = mentionsCount
let active = self.getActiveSectionId() == c.id # We must pass on if the current item section is currently active to keep that property as it is let active = self.getActiveSectionId() == c.id # We must pass on if the current item section is currently active to keep that property as it is
result = initItem( result = initItem(
c.id, c.id,