fix(edit): fix edits received before the message did not appear

Fixes #14479

The problem is our code assumed that we'd have the original message first, but in the case where messages are sent and edited before we open our app, when we fetch, we can't guarantee the order, so we might get the fully edited message directly from status-go.

The solution is simply to treat those messages as new messages.
This commit is contained in:
Jonathan Rainville 2024-04-18 16:02:12 -04:00
parent 1da3c26da1
commit bff7936779
1 changed files with 2 additions and 0 deletions

View File

@ -604,6 +604,8 @@ method editMessage*(self: Module, messageId: string, contentType: int, updatedMs
method onMessageEdited*(self: Module, message: MessageDto) =
let itemBeforeChange = self.view.model().getItemWithMessageId(message.id)
if(itemBeforeChange.isNil):
# We received the edited message before we received the real message. Just show the final message as is
self.messagesAdded(@[message])
return
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks