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

Improve thread partitioning for 2nd degree relations (#2165)

This commit is contained in:
Germain
2022-02-10 15:09:46 +00:00
committed by GitHub
parent 47c5c4645e
commit 6b822ccd61
9 changed files with 190 additions and 228 deletions

View File

@@ -512,8 +512,7 @@ export class MatrixEvent extends EventEmitter {
if (relatesTo?.rel_type === RelationType.Thread) {
return relatesTo.event_id;
} else {
return this.threadId
|| this.getThread()?.id;
return this.getThread()?.id || this.threadId;
}
}
@@ -537,10 +536,6 @@ export class MatrixEvent extends EventEmitter {
return !!threadDetails || (this.getThread()?.id === this.getId());
}
public get parentEventId(): string {
return this.replyEventId || this.relationEventId;
}
public get replyEventId(): string {
// We're prefer ev.getContent() over ev.getWireContent() to make sure
// we grab the latest edit with potentially new relations. But we also
@@ -1427,7 +1422,9 @@ export class MatrixEvent extends EventEmitter {
*/
public getAssociatedId(): string | undefined {
const relation = this.getRelation();
if (relation) {
if (this.replyEventId) {
return this.replyEventId;
} else if (relation) {
return relation.event_id;
} else if (this.isRedaction()) {
return this.event.redacts;
@@ -1561,6 +1558,7 @@ export class MatrixEvent extends EventEmitter {
*/
public setThread(thread: Thread): void {
this.thread = thread;
this.setThreadId(thread.id);
this.reEmitter.reEmit(thread, [ThreadEvent.Ready, ThreadEvent.Update]);
}