feat(@desktop/chat): update lastMessageTimestamp on message sent

iterates: #6634
This commit is contained in:
Patryk Osmaczko 2022-08-17 18:58:15 +02:00 committed by osmaczko
parent 876099b369
commit 781ec30e7f
3 changed files with 8 additions and 1 deletions

View File

@ -61,6 +61,10 @@ proc getActiveChatId*(self: Controller): string =
proc init*(self: Controller) =
self.events.on(SIGNAL_SENDING_SUCCESS) do(e:Args):
let args = MessageSendingSuccess(e)
self.delegate.updateLastMessageTimestamp(args.chat.id, args.chat.timestamp.int)
self.events.on(SIGNAL_NEW_MESSAGE_RECEIVED) do(e: Args):
let args = MessagesArgs(e)
if (self.sectionId != args.sectionId or args.messages.len == 0):

View File

@ -310,3 +310,6 @@ method onMeMentionedInEditedMessage*(self: AccessInterface, chatId: string, edit
method downloadMessages*(self: AccessInterface, chatId: string, filePath: string) =
raise newException(ValueError, "No implementation available")
method updateLastMessageTimestamp*(self: AccessInterface, chatId: string, lastMessageTimestamp: int) =
raise newException(ValueError, "No implementation available")

View File

@ -363,7 +363,7 @@ proc updateBadgeNotifications(self: Module, chatId: string, hasUnreadMessages: b
# update parent module
self.updateParentBadgeNotifications()
proc updateLastMessageTimestamp(self: Module, chatId: string, lastMessageTimestamp: int) =
method updateLastMessageTimestamp*(self: Module, chatId: string, lastMessageTimestamp: int) =
self.view.chatsModel().updateLastMessageTimestampForItemById(chatId, lastMessageTimestamp)
method onActiveSectionChange*(self: Module, sectionId: string) =