Convert markdown to HTML when a caption is edited

Adding or editing a media caption from the plain composer sent the
caption as text only: the composer has no HTML to pass, and the media
caption edit was built by hand with a null formatted body, so the
markdown was never rendered. Sending a caption with the same markdown
does render it, because the SDK builds the formatted body there.

Build the edit with the SDK's createCaptionEdit, which runs the caption
through the same markdown conversion the send path uses.
This commit is contained in:
hayaksi1
2026-08-17 03:40:11 +03:00
parent 23b75c3423
commit 537842bb40
@@ -75,6 +75,7 @@ import org.matrix.rustcomponents.sdk.PollData
import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle
import org.matrix.rustcomponents.sdk.UploadParameters
import org.matrix.rustcomponents.sdk.UploadSource
import org.matrix.rustcomponents.sdk.createCaptionEdit
import org.matrix.rustcomponents.sdk.use
import timber.log.Timber
import uniffi.matrix_sdk.PaginationStatus
@@ -341,7 +342,7 @@ class RustTimeline(
formattedCaption: String?,
): Result<Unit> = withContext(dispatcher) {
runCatchingExceptions<Unit> {
val editedContent = EditedContent.MediaCaption(
val editedContent = createCaptionEdit(
caption = caption,
formattedCaption = formattedCaption?.let {
FormattedBody(body = it, format = MessageFormat.Html)