fix(pins): fix edits not showing in the pinned messages until restart
Fixes #16639
This commit is contained in:
parent
8460c22240
commit
86a6d48546
|
@ -184,6 +184,12 @@ proc init*(self: Controller) =
|
||||||
return
|
return
|
||||||
self.delegate.onGroupChatDetailsUpdated(args.newName, args.newColor, args.newImage)
|
self.delegate.onGroupChatDetailsUpdated(args.newName, args.newColor, args.newImage)
|
||||||
|
|
||||||
|
self.events.on(SIGNAL_MESSAGE_EDITED) do(e: Args):
|
||||||
|
let args = MessageEditedArgs(e)
|
||||||
|
if(self.chatId != args.chatId):
|
||||||
|
return
|
||||||
|
self.delegate.onMessageEdited(args.message)
|
||||||
|
|
||||||
proc getMyChatId*(self: Controller): string =
|
proc getMyChatId*(self: Controller): string =
|
||||||
return self.chatId
|
return self.chatId
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import NimQml
|
import NimQml
|
||||||
|
|
||||||
import ../item as chat_item
|
import ../item as chat_item
|
||||||
import ../../../../../app_service/service/message/dto/pinned_message
|
import app_service/service/message/dto/pinned_message
|
||||||
import ../../../../../app_service/service/chat/dto/chat
|
import app_service/service/chat/dto/chat
|
||||||
|
import app_service/service/message/dto/message
|
||||||
type
|
type
|
||||||
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
||||||
|
|
||||||
|
@ -31,7 +31,10 @@ method newPinnedMessagesLoaded*(self: AccessInterface, pinnedMessages: seq[Pinne
|
||||||
method onUnpinMessage*(self: AccessInterface, messageId: string) {.base.} =
|
method onUnpinMessage*(self: AccessInterface, messageId: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method onPinMessage*(self: AccessInterface, mmessageId: string, actionInitiatedBy: string) {.base.} =
|
method onPinMessage*(self: AccessInterface, messageId: string, actionInitiatedBy: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method onMessageEdited*(self: AccessInterface, message: MessageDto) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method onChatMuted*(self: AccessInterface) {.base.} =
|
method onChatMuted*(self: AccessInterface) {.base.} =
|
||||||
|
|
|
@ -271,6 +271,27 @@ method onPinMessage*(self: Module, messageId: string, actionInitiatedBy: string)
|
||||||
|
|
||||||
self.view.pinnedModel().insertItemBasedOnClock(item)
|
self.view.pinnedModel().insertItemBasedOnClock(item)
|
||||||
|
|
||||||
|
method onMessageEdited*(self: Module, message: MessageDto) =
|
||||||
|
let index = self.view.pinnedModel().findIndexForMessageId(message.id)
|
||||||
|
if index == -1:
|
||||||
|
return
|
||||||
|
|
||||||
|
let itemBeforeChange = self.view.pinnedModel().getItemWithMessageId(message.id)
|
||||||
|
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks
|
||||||
|
let communityChats = self.controller.getCommunityDetails().chats
|
||||||
|
|
||||||
|
self.view.pinnedModel().updateEditedMsg(
|
||||||
|
message.id,
|
||||||
|
self.controller.getRenderedText(message.parsedText, communityChats),
|
||||||
|
message.text,
|
||||||
|
message.parsedText,
|
||||||
|
message.contentType,
|
||||||
|
message.mentioned,
|
||||||
|
message.containsContactMentions(),
|
||||||
|
message.links,
|
||||||
|
message.mentionedUsersPks
|
||||||
|
)
|
||||||
|
|
||||||
method getMyChatId*(self: Module): string =
|
method getMyChatId*(self: Module): string =
|
||||||
self.controller.getMyChatId()
|
self.controller.getMyChatId()
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ QtObject:
|
||||||
|
|
||||||
self.events.emit(SIGNAL_PINNED_MESSAGES_LOADED, data)
|
self.events.emit(SIGNAL_PINNED_MESSAGES_LOADED, data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Erorr load pinned messages for chat async", msg = e.msg
|
error "Error load pinned messages for chat async", msg = e.msg
|
||||||
# notify view, this is important
|
# notify view, this is important
|
||||||
self.events.emit(SIGNAL_PINNED_MESSAGES_LOADED, PinnedMessagesLoadedArgs())
|
self.events.emit(SIGNAL_PINNED_MESSAGES_LOADED, PinnedMessagesLoadedArgs())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue