Prevent unstable property to be sent with all events

This commit is contained in:
Germain Souquet 2021-09-02 08:36:20 +01:00
parent 95d1b06abb
commit 2ce8647120

View file

@ -209,14 +209,26 @@ export default class ReplyThread extends React.Component<IProps, IState> {
public static makeReplyMixIn(ev: MatrixEvent, replyInThread: boolean) {
if (!ev) return {};
return {
const replyMixin = {
'm.relates_to': {
'm.in_reply_to': {
'event_id': ev.getId(),
[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name]: replyInThread,
},
},
};
/**
* @experimental
* Rendering hint for threads, only attached if true to make
* sure that Element does not start sending that property for all events
*/
if (replyInThread) {
const inReplyTo = replyMixin['m.relates_to']['m.in_reply_to'];
inReplyTo[UNSTABLE_ELEMENT_REPLY_IN_THREAD.name] = replyInThread;
}
return replyMixin;
}
public static makeThread(