fix(message-service): fix receiving messages from channels not loaded

This commit is contained in:
Jonathan Rainville 2023-01-25 15:05:06 -05:00
parent 8bb9da6fcc
commit 6c1e16b72e
1 changed files with 1 additions and 7 deletions

View File

@ -240,19 +240,13 @@ QtObject:
if(chats[i].chatType == ChatType.OneToOne and not self.contactService.getContactById(chatId).isContact):
continue
let currentChatCursor = self.initOrGetMessageCursor(chatId)
# Ignore messages update if chat haven't loaded any messages and try to load them from database instead
if(currentChatCursor.isEmpty()):
currentChatCursor.makeObsolete()
self.asyncLoadMoreMessagesForChat(chatId)
continue
var chatMessages: seq[MessageDto]
for msg in messages:
if(msg.localChatId != chatId):
continue
# Ignore messages older than current chat cursor
let currentChatCursor = self.initOrGetMessageCursor(chatId)
let msgCursorValue = initCursorValue(msg.id, msg.clock)
if(not currentChatCursor.isLessThan(msgCursorValue)):
currentChatCursor.makeObsolete()