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,11 +388,11 @@ 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.notificationsCount = result.notificationsCount + subItem.BaseItem.notificationsCount
else:
result.hasNotifications = result.hasNotifications or self.items[i].BaseItem.hasUnreadMessages result.hasNotifications = result.hasNotifications or self.items[i].BaseItem.hasUnreadMessages
result.notificationsCount = result.notificationsCount + self.items[i].BaseItem.notificationsCount result.notificationsCount = result.notificationsCount + self.items[i].BaseItem.notificationsCount

View File

@ -343,6 +343,7 @@ 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
if singletonInstance.localAccountSensitiveSettings.getActiveSection() == self.controller.getMySectionId():
self.controller.markAllMessagesRead(self.controller.getActiveChatId()) self.controller.markAllMessagesRead(self.controller.getActiveChatId())
method getModuleAsVariant*(self: Module): QVariant = method getModuleAsVariant*(self: Module): QVariant =