diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index ec20f48a..b3ac3e9c 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -32,7 +32,11 @@ export class BaseEventEntry extends BaseEntry { } get isReply() { - return !!this.relation?.["m.in_reply_to"]; + return !!(this.relation?.["m.in_reply_to"] || this.isThread); + } + + get isThread() { + return this.relation?.["rel_type"] === "io.element.thread"; } get isRedacting() { diff --git a/src/matrix/room/timeline/entries/reply.js b/src/matrix/room/timeline/entries/reply.js index 2e180c11..bbb2d53d 100644 --- a/src/matrix/room/timeline/entries/reply.js +++ b/src/matrix/room/timeline/entries/reply.js @@ -51,6 +51,9 @@ function _createReplyContent(targetId, msgtype, body, formattedBody) { } export function createReplyContent(entry, msgtype, body) { + if (entry.isThread) { + return createThreadContent(entry, msgtype, body); + } // TODO check for absense of sender / body / msgtype / etc? const nonTextual = fallbackForNonTextualMessage(entry.content.msgtype); const prefix = fallbackPrefix(entry.content.msgtype); @@ -72,3 +75,14 @@ export function createReplyContent(entry, msgtype, body) { const newFormattedBody = formattedFallback + htmlEscape(body); return _createReplyContent(entry.id, msgtype, newBody, newFormattedBody); } + +function createThreadContent(entry, msgtype, body) { + return { + msgtype, + body, + "m.relates_to": { + "rel_type": "m.thread", + "event_id": entry.id + } + }; +}