diff --git a/src/components/views/elements/ReplyThread.tsx b/src/components/views/elements/ReplyThread.tsx index 7dd81f469a..3243d5ee03 100644 --- a/src/components/views/elements/ReplyThread.tsx +++ b/src/components/views/elements/ReplyThread.tsx @@ -35,6 +35,8 @@ import Spinner from './Spinner'; import ReplyTile from "../rooms/ReplyTile"; import Pill from './Pill'; import { Room } from 'matrix-js-sdk/src/models/room'; +import { threadId } from 'worker_threads'; +import { RelationType } from 'matrix-js-sdk/src/@types/event'; /** * This number is based on the previous behavior - if we have message of height @@ -226,13 +228,30 @@ export default class ReplyThread extends React.Component { public static makeReplyMixIn(ev: MatrixEvent) { if (!ev) return {}; - return { + + const mixin: any = { 'm.relates_to': { 'm.in_reply_to': { 'event_id': ev.getId(), }, }, }; + + /** + * If the event replied is part of a thread + * Add the `m.thread` relation so that clients + * that know how to handle that relation will + * be able to render them more accurately + */ + if (ev.isThreadRelation) { + mixin['m.relates_to'] = { + ...mixin['m.relates_to'], + rel_type: RelationType.Thread, + event_id: ev.threadRootId, + }; + } + + return mixin; } public static hasThreadReply(event: MatrixEvent) {