From c0d39a598333f6b00b40d41d44519037dca89b3e Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 23 Jul 2021 15:34:04 -0700 Subject: [PATCH] Add very rudimentary fallback reply formatting code --- src/matrix/room/timeline/entries/BaseEventEntry.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index b1744227..5c4ef6cf 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -151,8 +151,18 @@ export class BaseEventEntry extends BaseEntry { 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) { - 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 */