fix(muted): reevaluate section badge when unmuting (#15360)
Fixes #11093 When unmuting a channel, reevaluate the section badge so that it appears if there were unread messages in that channel Also fixes an issue where the chat muted property was not set correctly in the cache after muting or unmuting
This commit is contained in:
parent
459bbf7cc9
commit
35b64f0483
|
@ -132,7 +132,6 @@ proc init*(self: Controller) =
|
|||
let chat = self.chatService.getChatById(args.chatId)
|
||||
self.delegate.onMarkMessageAsUnread(chat)
|
||||
|
||||
|
||||
self.events.on(chat_service.SIGNAL_CHAT_LEFT) do(e: Args):
|
||||
let args = chat_service.ChatArgs(e)
|
||||
self.delegate.onCommunityChannelDeletedOrChatLeft(args.chatId)
|
||||
|
|
|
@ -948,6 +948,7 @@ method onCategoryUnmuted*(self: Module, categoryId: string) =
|
|||
|
||||
method changeMutedOnChat*(self: Module, chatId: string, muted: bool) =
|
||||
self.view.chatsModel().changeMutedOnItemById(chatId, muted)
|
||||
self.updateParentBadgeNotifications()
|
||||
|
||||
proc changeCanPostValues*(self: Module, chatId: string, canPost, canView, canPostReactions, viewersCanPostReactions: bool) =
|
||||
self.view.chatsModel().changeCanPostValues(chatId, canPost, canView, canPostReactions, viewersCanPostReactions)
|
||||
|
|
|
@ -575,6 +575,11 @@ QtObject:
|
|||
error "error while mute chat ", msg
|
||||
return
|
||||
|
||||
# There is no response except an error, so we can just modify the chat ourselves
|
||||
var chat = self.chats[chatID]
|
||||
chat.muted = true
|
||||
self.updateOrAddChat(chat)
|
||||
|
||||
self.events.emit(SIGNAL_CHAT_MUTED, ChatArgs(chatId: chatId))
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
|
@ -593,6 +598,11 @@ QtObject:
|
|||
error "error while unmute chat ", msg
|
||||
return
|
||||
|
||||
# There is no response except an error, so we can just modify the chat ourselves
|
||||
var chat = self.chats[chatID]
|
||||
chat.muted = false
|
||||
self.updateOrAddChat(chat)
|
||||
|
||||
self.events.emit(SIGNAL_CHAT_UNMUTED, ChatArgs(chatId: chatId))
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
|
|
Loading…
Reference in New Issue