Skip to content

Commit

Permalink
fix(@desktop/chat): Fix displaying edits of bridge messages
Browse files Browse the repository at this point in the history
Fix #14044
  • Loading branch information
endulab committed Mar 25, 2024
1 parent 3b16f20 commit fc52d65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,15 @@ method onMessageEdited*(self: Module, message: MessageDto) =
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks
let communityChats = self.controller.getCommunityDetails().chats

var updatedText = ""
if message.contentType == ContentType.BridgeMessage:
updatedText = message.bridgeMessage.content
else:
updatedText = self.controller.getRenderedText(message.parsedText, communityChats)

self.view.model().updateEditedMsg(
message.id,
self.controller.getRenderedText(message.parsedText, communityChats),
updatedText,
message.text,
message.parsedText,
message.contentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Item {
isQuote = (formattedMessage.startsWith("<blockquote>") && formattedMessage.endsWith("</blockquote>"));

if (root.isEdited) {
if (root.messageDetails.contentType === StatusMessage.ContentType.BridgeMessage) {
// message from bridge does not have any tags, we need to add them here to format correctly
formattedMessage = "<p>"+root.messageDetails.messageText+"</p>"
}

const index = formattedMessage.endsWith("code>") ? formattedMessage.length : formattedMessage.length - 4;
const editedMessage = formattedMessage.slice(0, index)
+ ` <span class="isEdited">` + qsTr("(edited)") + `</span>`
Expand Down

0 comments on commit fc52d65

Please sign in to comment.