From dc9ec8526c7026cba035bf78cd615326e94aeb92 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 3 May 2022 14:52:51 +0100 Subject: [PATCH] Match MSC behaviour for threads when disabled (thread-aware mode) (#8476) --- src/utils/Reply.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/utils/Reply.ts b/src/utils/Reply.ts index 87cec553737..cdc48c804f1 100644 --- a/src/utils/Reply.ts +++ b/src/utils/Reply.ts @@ -152,8 +152,17 @@ export function makeReplyMixIn(ev?: MatrixEvent): IEventRelation { }, }; - if (SettingsStore.getValue("feature_thread") && ev.threadRootId) { - mixin.is_falling_back = false; + if (ev.threadRootId) { + if (SettingsStore.getValue("feature_thread")) { + mixin.is_falling_back = false; + } else { + // Clients that do not offer a threading UI should behave as follows when replying, for best interaction + // with those that do. They should set the m.in_reply_to part as usual, and then add on + // "rel_type": "m.thread" and "event_id": "$thread_root", copying $thread_root from the replied-to event. + const relation = ev.getRelation(); + mixin.rel_type = relation.rel_type; + mixin.event_id = relation.event_id; + } } return mixin;