fix(chat_section): fix parent badge not updating on chat close and open

Fixes #14025
This commit is contained in:
Jonathan Rainville 2024-04-12 13:38:27 -04:00
parent 8be1453fd0
commit 7421d5b425
1 changed files with 4 additions and 6 deletions

View File

@ -837,6 +837,8 @@ method onCommunityChannelDeletedOrChatLeft*(self: Module, chatId: string) =
if chatId == activeChatId:
self.setFirstChannelAsActive()
self.updateParentBadgeNotifications()
proc refreshHiddenBecauseNotPermittedState(self: Module) =
self.view.refreshAllChannelsAreHiddenBecauseNotPermittedChanged()
@ -1393,10 +1395,6 @@ proc addOrUpdateChat(self: Module,
not belongsToCommunity and sectionId != singletonInstance.userProfile.getPubKey()):
return
let chatExists = self.doesCatOrChatExist(chat.id)
if not self.chatsLoaded or chatExists:
# Update badges
self.updateBadgeNotifications(chat, chat.unviewedMessagesCount > 0, chat.unviewedMentionsCount)
if not self.chatsLoaded:
@ -1406,7 +1404,7 @@ proc addOrUpdateChat(self: Module,
if chat.id == activeChatId:
self.updateActiveChatMembership()
if chatExists:
if self.doesCatOrChatExist(chat.id):
self.changeMutedOnChat(chat.id, chat.muted)
self.changeCanPostValues(chat.id, chat.canPostReactions, chat.viewersCanPostReactions)
self.updateChatRequiresPermissions(chat.id)