Send a formatted body from quotes

This commit is contained in:
Danila Fedorin 2021-07-23 16:45:22 -07:00
parent 0db6870edb
commit 305fab467e
2 changed files with 7 additions and 3 deletions

View file

@ -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 `<mx-reply>
@ -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 */

View file

@ -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