fix(@desktop/edit) : clicking up arrow opens edit view for a message with image (#12680)

Co-authored-by: kounkou <jacques@status.im>
This commit is contained in:
Godfrain Jacques 2023-11-10 09:47:11 -08:00 committed by GitHub
parent 97da863d70
commit b0e2651ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -122,9 +122,12 @@ QtObject:
proc jumpToMessage*(self: View, messageId: string) {.slot.} =
self.delegate.scrollToMessage(messageId)
proc isEditAllowed(messageImage: string, sticker: string): bool =
return messageImage == "" and sticker == ""
proc setEditModeOnAndScrollToLastMessage*(self: View, pubkey: string) {.slot.} =
let lastMessage = self.model.getLastItemFrom(pubKey)
if lastMessage != nil and lastMessage.id != "":
if lastMessage != nil and lastMessage.id != "" and isEditAllowed(lastMessage.messageImage, lastMessage.sticker):
self.model.setEditModeOn(lastMessage.id)
self.jumpToMessage(lastMessage.id)