Add 'm.thread' relation for replies to a threaded event
This commit is contained in:
parent
d315641056
commit
378536ee2a
1 changed files with 20 additions and 1 deletions
|
@ -35,6 +35,8 @@ import Spinner from './Spinner';
|
||||||
import ReplyTile from "../rooms/ReplyTile";
|
import ReplyTile from "../rooms/ReplyTile";
|
||||||
import Pill from './Pill';
|
import Pill from './Pill';
|
||||||
import { Room } from 'matrix-js-sdk/src/models/room';
|
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
|
* 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<IProps, IState> {
|
||||||
|
|
||||||
public static makeReplyMixIn(ev: MatrixEvent) {
|
public static makeReplyMixIn(ev: MatrixEvent) {
|
||||||
if (!ev) return {};
|
if (!ev) return {};
|
||||||
return {
|
|
||||||
|
const mixin: any = {
|
||||||
'm.relates_to': {
|
'm.relates_to': {
|
||||||
'm.in_reply_to': {
|
'm.in_reply_to': {
|
||||||
'event_id': ev.getId(),
|
'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) {
|
public static hasThreadReply(event: MatrixEvent) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue