fix(categories): fix category unread status
Part of #14886 The problem was that the ChatDto doesn't have a categoryID, so we need to use the CommunityChat. I think before, the channel groups had the full chat info, but not we can't rely on that. The CommunityChat/Chat alignment refactor will simplify all of that https://github.com/status-im/status-desktop/issues/14219
This commit is contained in:
parent
6a820c9e72
commit
9523e6b764
|
@ -597,9 +597,13 @@ proc updateBadgeNotifications(self: Module, chat: ChatDto, hasUnreadMessages: bo
|
||||||
if (self.chatContentModules.contains(chatId)):
|
if (self.chatContentModules.contains(chatId)):
|
||||||
self.chatContentModules[chatId].onNotificationsUpdated(hasUnreadMessages, unviewedMentionsCount)
|
self.chatContentModules[chatId].onNotificationsUpdated(hasUnreadMessages, unviewedMentionsCount)
|
||||||
|
|
||||||
if chat.categoryId != "":
|
if self.isCommunity:
|
||||||
let hasUnreadMessages = self.controller.categoryHasUnreadMessages(chat.communityId, chat.categoryId)
|
let myCommunity = self.controller.getMyCommunity()
|
||||||
self.view.chatsModel().setCategoryHasUnreadMessages(chat.categoryId, hasUnreadMessages)
|
let communityChat = myCommunity.getCommunityChat(chatId)
|
||||||
|
|
||||||
|
if communityChat.categoryId != "":
|
||||||
|
let hasUnreadMessages = self.controller.categoryHasUnreadMessages(communityChat.communityId, communityChat.categoryId)
|
||||||
|
self.view.chatsModel().setCategoryHasUnreadMessages(communityChat.categoryId, hasUnreadMessages)
|
||||||
|
|
||||||
self.updateParentBadgeNotifications()
|
self.updateParentBadgeNotifications()
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ QtObject:
|
||||||
var args = RpcResponseArgs(e)
|
var args = RpcResponseArgs(e)
|
||||||
discard self.processMessengerResponse(args.response)
|
discard self.processMessengerResponse(args.response)
|
||||||
|
|
||||||
proc asyncGetActiveChat*(self: Service) =
|
proc asyncGetActiveChats*(self: Service) =
|
||||||
let arg = AsyncGetActiveChatsTaskArg(
|
let arg = AsyncGetActiveChatsTaskArg(
|
||||||
tptr: cast[ByteAddress](asyncGetActiveChatsTask),
|
tptr: cast[ByteAddress](asyncGetActiveChatsTask),
|
||||||
vptr: cast[ByteAddress](self.vptr),
|
vptr: cast[ByteAddress](self.vptr),
|
||||||
|
@ -213,7 +213,7 @@ QtObject:
|
||||||
proc init*(self: Service) =
|
proc init*(self: Service) =
|
||||||
self.doConnect()
|
self.doConnect()
|
||||||
|
|
||||||
self.asyncGetActiveChat()
|
self.asyncGetActiveChats()
|
||||||
|
|
||||||
proc hasChannel*(self: Service, chatId: string): bool =
|
proc hasChannel*(self: Service, chatId: string): bool =
|
||||||
self.chats.hasKey(chatId)
|
self.chats.hasKey(chatId)
|
||||||
|
|
|
@ -2424,6 +2424,7 @@ QtObject:
|
||||||
for chat in self.communities[communityId].chats:
|
for chat in self.communities[communityId].chats:
|
||||||
if chat.categoryId != categoryId:
|
if chat.categoryId != categoryId:
|
||||||
continue
|
continue
|
||||||
if (not chat.muted and chat.unviewedMessagesCount > 0) or chat.unviewedMentionsCount > 0:
|
let chatDto = self.chatService.getChatById(chat.id)
|
||||||
|
if (not chatDto.muted and chatDto.unviewedMessagesCount > 0) or chatDto.unviewedMentionsCount > 0:
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue