From d5ab4ba2efb58846a6e1f934ca321b42fb3676fe Mon Sep 17 00:00:00 2001 From: Germain Date: Wed, 20 Oct 2021 16:49:54 +0100 Subject: [PATCH] Update thread replies count to only include m.thread (#1991) --- src/models/thread.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/models/thread.ts b/src/models/thread.ts index b8ac23d76..fbad42c2f 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -46,7 +46,7 @@ export class Thread extends EventEmitter { public readonly client: MatrixClient, ) { super(); - this.timelineSet = new EventTimelineSet(room, { + this.timelineSet = new EventTimelineSet(null, { unstableClientRelationAggregation: true, timelineSupport: true, }); @@ -135,9 +135,13 @@ export class Thread extends EventEmitter { /** * The number of messages in the thread + * Only count rel_type=m.thread as we want to + * exclude annotations from that number */ public get length(): number { - return this.events.length; + return this.events + .filter(event => event.isThreadRelation) + .length; } /**