forked from mystiq/hydrogen-web
Send a formatted body from quotes
This commit is contained in:
parent
0db6870edb
commit
305fab467e
2 changed files with 7 additions and 3 deletions
|
@ -170,7 +170,7 @@ export class BaseEventEntry extends BaseEntry {
|
||||||
|
|
||||||
_replyFormattedFallback() {
|
_replyFormattedFallback() {
|
||||||
// TODO check for absense?
|
// 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 body = this._fallbackBlurb() || this.content.formatted_body || this.content.body;
|
||||||
const prefix = this._fallbackPrefix();
|
const prefix = this._fallbackPrefix();
|
||||||
return `<mx-reply>
|
return `<mx-reply>
|
||||||
|
@ -192,7 +192,9 @@ export class BaseEventEntry extends BaseEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
reply(msgtype, body) {
|
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 */
|
/** takes both remote event id and local txn id into account, see overriding in PendingEventEntry */
|
||||||
|
|
|
@ -29,10 +29,12 @@ export function createAnnotation(targetId, key) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createReply(targetId, msgtype, body) {
|
export function createReply(targetId, msgtype, body, formattedBody) {
|
||||||
return {
|
return {
|
||||||
msgtype,
|
msgtype,
|
||||||
body,
|
body,
|
||||||
|
"format": "org.matrix.custom.html",
|
||||||
|
"formatted_body": formattedBody,
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"m.in_reply_to": {
|
"m.in_reply_to": {
|
||||||
"event_id": targetId
|
"event_id": targetId
|
||||||
|
|
Loading…
Reference in a new issue