1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Copy relations to thread root in the thread timeline (#2012)

This commit is contained in:
Germain
2021-11-05 14:16:45 +00:00
committed by GitHub
parent 195498e9db
commit 43bc09f392
3 changed files with 29 additions and 5 deletions

View File

@@ -438,14 +438,14 @@ export class MatrixEvent extends EventEmitter {
* @experimental
*/
public get isThreadRoot(): boolean {
// TODO, change the inner working of this getter for it to use the
// bundled relationship return on the event, view MSC3440
const thread = this.getThread();
return thread?.id === this.getId();
}
public get parentEventId(): string {
const relations = this.getWireContent()["m.relates_to"];
return relations?.["m.in_reply_to"]?.["event_id"]
|| relations?.event_id;
return this.replyEventId || this.relationEventId;
}
public get replyEventId(): string {
@@ -453,6 +453,12 @@ export class MatrixEvent extends EventEmitter {
return relations?.["m.in_reply_to"]?.["event_id"];
}
public get relationEventId(): string {
return this.getWireContent()
?.["m.relates_to"]
?.event_id;
}
/**
* Get the previous event content JSON. This will only return something for
* state events which exist in the timeline.