From 305fab467e8353505f6f9382bc0bd27d9b782312 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 23 Jul 2021 16:45:22 -0700 Subject: [PATCH] Send a formatted body from quotes --- src/matrix/room/timeline/entries/BaseEventEntry.js | 6 ++++-- src/matrix/room/timeline/relations.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index f59d15f4..a9825eaa 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -170,7 +170,7 @@ export class BaseEventEntry extends BaseEntry { _replyFormattedFallback() { // TODO check for absense? - // TODO escape unformatted body if needed + // TODO escape and tranform unformatted body as needed const body = this._fallbackBlurb() || this.content.formatted_body || this.content.body; const prefix = this._fallbackPrefix(); return ` @@ -192,7 +192,9 @@ export class BaseEventEntry extends BaseEntry { } reply(msgtype, body) { - return createReply(this.id, msgtype, this._replyBodyFallback() + '\n\n' + body); + const newBody = this._replyBodyFallback() + '\n\n' + body; + const newFormattedBody = this._replyFormattedFallback() + body; + return createReply(this.id, msgtype, newBody, newFormattedBody); } /** takes both remote event id and local txn id into account, see overriding in PendingEventEntry */ diff --git a/src/matrix/room/timeline/relations.js b/src/matrix/room/timeline/relations.js index b6d23c50..17d1e9d7 100644 --- a/src/matrix/room/timeline/relations.js +++ b/src/matrix/room/timeline/relations.js @@ -29,10 +29,12 @@ export function createAnnotation(targetId, key) { }; } -export function createReply(targetId, msgtype, body) { +export function createReply(targetId, msgtype, body, formattedBody) { return { msgtype, body, + "format": "org.matrix.custom.html", + "formatted_body": formattedBody, "m.relates_to": { "m.in_reply_to": { "event_id": targetId