refactor(chat): rename MESSAGE_FIRST_UNSEEN to FIRST_UNSEEN_MESSAGE_LOADED

- it describes the intention a bit better
This commit is contained in:
Patryk Osmaczko 2023-04-04 13:03:04 +02:00 committed by Jonathan Rainville
parent 9419c9acaf
commit ac01824ad5
4 changed files with 10 additions and 10 deletions

View File

@ -212,11 +212,11 @@ proc init*(self: Controller) =
if (community.id == self.sectionId):
self.delegate.updateCommunityDetails(community)
self.events.on(SIGNAL_MESSAGE_FIRST_UNSEEN) do(e: Args):
let args = MessageFirstUnseen(e)
self.events.on(SIGNAL_FIRST_UNSEEN_MESSAGE_LOADED) do(e: Args):
let args = FirstUnseenMessageLoadedArgs(e)
if (args.chatId != self.chatId):
return
self.delegate.onFirstUnseenMessageId(args.messageId)
self.delegate.onFirstUnseenMessageLoaded(args.messageId)
proc getMySectionId*(self: Controller): string =
return self.sectionId

View File

@ -159,5 +159,5 @@ method markAllMessagesRead*(self: AccessInterface) =
method updateCommunityDetails*(self: AccessInterface, community: CommunityDto) =
raise newException(ValueError, "No implementation available")
method onFirstUnseenMessageId*(self: AccessInterface, messageId: string) =
method onFirstUnseenMessageLoaded*(self: AccessInterface, messageId: string) =
raise newException(ValueError, "No implementation available")

View File

@ -716,7 +716,7 @@ proc updateItemsByAlbum(self: Module, items: var seq[Item], message: MessageDto)
return true
return false
method onFirstUnseenMessageId*(self: Module, messageId: string) =
method onFirstUnseenMessageLoaded*(self: Module, messageId: string) =
self.view.model().setFirstUnseenMessageId(messageId)
self.view.model().resetNewMessagesMarker()
let index = self.view.model().findIndexForMessageId(messageId)

View File

@ -40,7 +40,7 @@ const WEEK_AS_MILLISECONDS = initDuration(seconds = 60*60*24*7).inMilliSeconds
# Signals which may be emitted by this service:
const SIGNAL_MESSAGES_LOADED* = "messagesLoaded"
const SIGNAL_MESSAGE_FIRST_UNSEEN* = "messageFirstUnseen"
const SIGNAL_FIRST_UNSEEN_MESSAGE_LOADED* = "firstUnseenMessageLoaded"
const SIGNAL_NEW_MESSAGE_RECEIVED* = "newMessageReceived"
const SIGNAL_MESSAGE_PINNED* = "messagePinned"
const SIGNAL_MESSAGE_UNPINNED* = "messageUnpinned"
@ -117,7 +117,7 @@ type
ReloadMessagesArgs* = ref object of Args
communityId*: string
MessageFirstUnseen* = ref object of Args
FirstUnseenMessageLoadedArgs* = ref object of Args
chatId*: string
messageId*: string
@ -687,7 +687,7 @@ QtObject:
else:
discard responseObj.getProp("messageId", messageId)
self.events.emit(SIGNAL_MESSAGE_FIRST_UNSEEN, MessageFirstUnseen(chatId: chatId, messageId: messageId))
self.events.emit(SIGNAL_FIRST_UNSEEN_MESSAGE_LOADED, FirstUnseenMessageLoadedArgs(chatId: chatId, messageId: messageId))
except Exception as e:
error "error: ", procName="onGetFirstUnseenMessageIdFor", errName = e.name, errDesription = e.msg