mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-23 03:58:49 +00:00
fix(@desktop/chat): the @mention emblem isn't being displayed on the channel list
Fixes #3630
This commit is contained in:
parent
bf6dbe4815
commit
98293c112b
@ -331,10 +331,22 @@ method getChatContentModule*(self: Module, chatId: string): QVariant =
|
|||||||
|
|
||||||
return self.chatContentModules[chatId].getModuleAsVariant()
|
return self.chatContentModules[chatId].getModuleAsVariant()
|
||||||
|
|
||||||
|
proc updateNotifications(self: Module, chatId: string, unviewedMessagesCount: int, unviewedMentionsCount: int) =
|
||||||
|
let hasUnreadMessages = unviewedMessagesCount > 0
|
||||||
|
# update model of this module (appropriate chat from the chats list (chats model))
|
||||||
|
self.view.chatsModel().updateNotificationsForItemOrSubItemById(chatId, hasUnreadMessages, unviewedMentionsCount)
|
||||||
|
# update child module
|
||||||
|
if (self.chatContentModules.contains(chatId)):
|
||||||
|
self.chatContentModules[chatId].onNotificationsUpdated(hasUnreadMessages, unviewedMentionsCount)
|
||||||
|
# update parent module
|
||||||
|
let (sectionHasUnreadMessages, sectionNotificationCount) = self.view.chatsModel().getAllNotifications()
|
||||||
|
self.delegate.onNotificationsUpdated(self.controller.getMySectionId(), sectionHasUnreadMessages, sectionNotificationCount)
|
||||||
|
|
||||||
method onActiveSectionChange*(self: Module, sectionId: string) =
|
method onActiveSectionChange*(self: Module, sectionId: string) =
|
||||||
if(sectionId != self.controller.getMySectionId()):
|
if(sectionId != self.controller.getMySectionId()):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.updateNotifications(self.controller.getActiveChatId(), unviewedMessagesCount=0, unviewedMentionsCount=0)
|
||||||
self.delegate.onActiveChatChange(self.controller.getMySectionId(), self.controller.getActiveChatId())
|
self.delegate.onActiveChatChange(self.controller.getMySectionId(), self.controller.getActiveChatId())
|
||||||
|
|
||||||
method createPublicChat*(self: Module, chatId: string) =
|
method createPublicChat*(self: Module, chatId: string) =
|
||||||
@ -456,17 +468,6 @@ method createOneToOneChat*(self: Module, chatId: string, ensName: string) =
|
|||||||
|
|
||||||
self.controller.createOneToOneChat(chatId, ensName)
|
self.controller.createOneToOneChat(chatId, ensName)
|
||||||
|
|
||||||
proc updateNotifications(self: Module, chatId: string, unviewedMessagesCount: int, unviewedMentionsCount: int) =
|
|
||||||
let hasUnreadMessages = unviewedMessagesCount > 0
|
|
||||||
# update model of this module (appropriate chat from the chats list (chats model))
|
|
||||||
self.view.chatsModel().updateNotificationsForItemOrSubItemById(chatId, hasUnreadMessages, unviewedMentionsCount)
|
|
||||||
# update child module
|
|
||||||
if (self.chatContentModules.contains(chatId)):
|
|
||||||
self.chatContentModules[chatId].onNotificationsUpdated(hasUnreadMessages, unviewedMentionsCount)
|
|
||||||
# update parent module
|
|
||||||
let (sectionHasUnreadMessages, sectionNotificationCount) = self.view.chatsModel().getAllNotifications()
|
|
||||||
self.delegate.onNotificationsUpdated(self.controller.getMySectionId(), sectionHasUnreadMessages, sectionNotificationCount)
|
|
||||||
|
|
||||||
method leaveChat*(self: Module, chatId: string) =
|
method leaveChat*(self: Module, chatId: string) =
|
||||||
self.controller.leaveChat(chatId)
|
self.controller.leaveChat(chatId)
|
||||||
|
|
||||||
@ -537,11 +538,10 @@ method onContactDetailsUpdated*(self: Module, publicKey: string) =
|
|||||||
|
|
||||||
method onNewMessagesReceived*(self: Module, chatId: string, unviewedMessagesCount: int, unviewedMentionsCount: int,
|
method onNewMessagesReceived*(self: Module, chatId: string, unviewedMessagesCount: int, unviewedMentionsCount: int,
|
||||||
messages: seq[MessageDto]) =
|
messages: seq[MessageDto]) =
|
||||||
let activeChatId = self.controller.getActiveChatId()
|
if(self.controller.getMySectionId() == self.delegate.getActiveSectionId() and
|
||||||
if(activeChatId == chatId):
|
self.controller.getActiveChatId() == chatId):
|
||||||
self.controller.markAllMessagesRead(chatId)
|
return
|
||||||
else:
|
self.updateNotifications(chatId, unviewedMessagesCount, unviewedMentionsCount)
|
||||||
self.updateNotifications(chatId, unviewedMessagesCount, unviewedMentionsCount)
|
|
||||||
|
|
||||||
proc convertPubKeysToJson(self: Module, pubKeys: string): seq[string] =
|
proc convertPubKeysToJson(self: Module, pubKeys: string): seq[string] =
|
||||||
return map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
|
return map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
|
||||||
|
@ -441,6 +441,9 @@ method emitStoringPasswordError*[T](self: Module[T], errorDescription: string) =
|
|||||||
method emitStoringPasswordSuccess*[T](self: Module[T]) =
|
method emitStoringPasswordSuccess*[T](self: Module[T]) =
|
||||||
self.view.emitStoringPasswordSuccess()
|
self.view.emitStoringPasswordSuccess()
|
||||||
|
|
||||||
|
method getActiveSectionId*[T](self: Module[T]): string =
|
||||||
|
return self.controller.getActiveSectionId()
|
||||||
|
|
||||||
method setActiveSection*[T](self: Module[T], item: SectionItem) =
|
method setActiveSection*[T](self: Module[T], item: SectionItem) =
|
||||||
if(item.isEmpty()):
|
if(item.isEmpty()):
|
||||||
echo "section is empty and cannot be made as active one"
|
echo "section is empty and cannot be made as active one"
|
||||||
|
@ -9,4 +9,7 @@ method onActiveChatChange*(self: AccessInterface, sectionId: string, chatId: str
|
|||||||
|
|
||||||
method onNotificationsUpdated*(self: AccessInterface, sectionId: string, sectionHasUnreadMessages: bool,
|
method onNotificationsUpdated*(self: AccessInterface, sectionId: string, sectionHasUnreadMessages: bool,
|
||||||
sectionNotificationCount: int) {.base.} =
|
sectionNotificationCount: int) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method getActiveSectionId*(self: AccessInterface): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
Loading…
x
Reference in New Issue
Block a user