fix(@desktop/chat): No visual notification about new messages in community channels

This commit is contained in:
mprakhov 2022-11-21 20:03:56 +02:00 committed by Mykhailo Prakhov
parent 8e4d9be779
commit 0baa49c978
2 changed files with 8 additions and 7 deletions

View File

@ -388,13 +388,13 @@ QtObject:
result.hasNotifications = false result.hasNotifications = false
result.notificationsCount = 0 result.notificationsCount = 0
for i in 0 ..< self.items.len: for i in 0 ..< self.items.len:
# if it's category item type is set to `ChatType.Unknown`
# (in one point of time we may start maintaining notifications per category as well)
if(self.items[i].BaseItem.`type` == ChatType.Unknown.int): if(self.items[i].BaseItem.`type` == ChatType.Unknown.int):
continue for subItem in self.items[i].subItems().items():
result.hasNotifications = result.hasNotifications or subItem.BaseItem.hasUnreadMessages
result.hasNotifications = result.hasNotifications or self.items[i].BaseItem.hasUnreadMessages result.notificationsCount = result.notificationsCount + subItem.BaseItem.notificationsCount
result.notificationsCount = result.notificationsCount + self.items[i].BaseItem.notificationsCount else:
result.hasNotifications = result.hasNotifications or self.items[i].BaseItem.hasUnreadMessages
result.notificationsCount = result.notificationsCount + self.items[i].BaseItem.notificationsCount
proc reorderModel*(self: Model, id: string, position: int) = proc reorderModel*(self: Model, id: string, position: int) =
let index = self.getItemIdxById(id) let index = self.getItemIdxById(id)

View File

@ -343,7 +343,8 @@ method activeItemSubItemSet*(self: Module, itemId: string, subItemId: string) =
# notify parent module about active chat/channel # notify parent module about active chat/channel
self.delegate.onActiveChatChange(self.controller.getMySectionId(), self.controller.getActiveChatId()) self.delegate.onActiveChatChange(self.controller.getMySectionId(), self.controller.getActiveChatId())
# update notifications caused by setting active chat/channel # update notifications caused by setting active chat/channel
self.controller.markAllMessagesRead(self.controller.getActiveChatId()) if singletonInstance.localAccountSensitiveSettings.getActiveSection() == self.controller.getMySectionId():
self.controller.markAllMessagesRead(self.controller.getActiveChatId())
method getModuleAsVariant*(self: Module): QVariant = method getModuleAsVariant*(self: Module): QVariant =
return self.viewVariant return self.viewVariant