From e86a625b927b729897a15c188d73714ddcc447ba Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 31 Mar 2023 13:39:54 -0400 Subject: [PATCH] fix(edit): don't send new message event on edits Fixes #10108 We were sending SIGNAL_NEW_MESSAGE_RECEIVED and SIGNAL_MESSAGE_EDITED, but the former is not needed, because the message editing is all done with the latter. The new message signal was sending the OS notification, which is not wanted, plus it did some useless processing, like trying to re-edit the message model, when it was already done. --- src/app_service/service/message/service.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app_service/service/message/service.nim b/src/app_service/service/message/service.nim index 10ba4ab2c1..cd08cfb2d4 100644 --- a/src/app_service/service/message/service.nim +++ b/src/app_service/service/message/service.nim @@ -248,18 +248,18 @@ QtObject: continue # Ignore messages older than current chat cursor - if(self.isChatCursorInitialized(chatId)): + if self.isChatCursorInitialized(chatId): let currentChatCursor = self.initOrGetMessageCursor(chatId) let msgCursorValue = initCursorValue(msg.id, msg.clock) if(not currentChatCursor.isLessThan(msgCursorValue)): currentChatCursor.makeObsolete() continue - if(msg.editedAt > 0): + if msg.editedAt > 0: let data = MessageEditedArgs(chatId: msg.localChatId, message: msg) self.events.emit(SIGNAL_MESSAGE_EDITED, data) - - chatMessages.add(msg) + else: + chatMessages.add(msg) let data = MessagesArgs( sectionId: if chats[i].communityId.len != 0: chats[i].communityId else: singletonInstance.userProfile.getPubKey(),