Skip to content

Commit 320aae1

Browse files
ganfrajmartinesp
authored andcommitted
Also fix pills with rich text editor
1 parent b72039e commit 320aae1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/relation/EventEditor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ internal class EventEditor @Inject constructor(
131131
replyToEdit,
132132
originalTimelineEvent,
133133
newBodyText,
134+
newBodyFormattedText,
134135
true,
135136
MessageType.MSGTYPE_TEXT,
136137
compatibilityBodyText

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ internal class LocalEchoEventFactory @Inject constructor(
312312
roomId: String,
313313
eventReplaced: TimelineEvent,
314314
originalEvent: TimelineEvent,
315-
newBodyText: CharSequence,
315+
replyText: CharSequence,
316+
replyTextFormatted: String?,
316317
autoMarkdown: Boolean,
317318
msgType: String,
318319
compatibilityText: String,
@@ -321,22 +322,22 @@ internal class LocalEchoEventFactory @Inject constructor(
321322
val permalink = permalinkFactory.createPermalink(roomId, originalEvent.root.eventId ?: "", false)
322323
val userLink = originalEvent.root.senderId?.let { permalinkFactory.createPermalink(it, false) } ?: ""
323324

324-
val body = bodyForReply(timelineEvent = originalEvent)
325+
val bodyOfRepliedEvent = bodyForReply(timelineEvent = originalEvent)
325326
// As we always supply formatted body for replies we should force the MarkdownParser to produce html.
326-
val newBodyFormatted = markdownParser.parse(newBodyText, force = true, advanced = autoMarkdown).takeFormatted()
327+
val newBodyFormatted = replyTextFormatted ?: markdownParser.parse(replyText, force = true, advanced = autoMarkdown).takeFormatted()
327328
// Body of the original message may not have formatted version, so may also have to convert to html.
328-
val bodyFormatted = body.formattedText ?: markdownParser.parse(body.text, force = true, advanced = autoMarkdown).takeFormatted()
329+
val formattedBodyOfRepliedEvent = bodyOfRepliedEvent.formattedText ?: markdownParser.parse(bodyOfRepliedEvent.text, force = true, advanced = autoMarkdown).takeFormatted()
329330
val replyFormatted = buildFormattedReply(
330331
permalink,
331332
userLink,
332333
originalEvent.senderInfo.disambiguatedDisplayName,
333-
bodyFormatted,
334+
formattedBodyOfRepliedEvent,
334335
newBodyFormatted
335336
)
336337
//
337338
// > <@alice:example.org> This is the original body
338339
//
339-
val replyFallback = buildReplyFallback(body, originalEvent.root.senderId ?: "", newBodyText.toString())
340+
val replyFallback = buildReplyFallback(bodyOfRepliedEvent, originalEvent.root.senderId ?: "", replyText.toString())
340341

341342
return createMessageEvent(
342343
roomId,

0 commit comments

Comments
 (0)