Add very rudimentary fallback reply formatting code

This commit is contained in:
Danila Fedorin 2021-07-23 15:34:04 -07:00
parent 73ca5d21ff
commit c0d39a5983

View file

@ -151,8 +151,18 @@ export class BaseEventEntry extends BaseEntry {
return createAnnotation(this.id, key); return createAnnotation(this.id, key);
} }
_formatReplyBody() {
// This is just a rough sketch for now.
// TODO case-by-case formatting
// TODO check for absense?
const bodyLines = this.content.body.split("\n");
const sender = this.sender;
bodyLines[0] = `<${sender}> ${bodyLines[0]}`
return `> ${bodyLines.join("\n> ")}\n\n`;
}
reply(msgtype, body) { reply(msgtype, body) {
return createReply(this.id, msgtype, body); return createReply(this.id, msgtype, this._formatReplyBody() + body);
} }
/** 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 */