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

View File

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