From b07d44a6c0579d52f20e9a7b58e5aaf902d41daf Mon Sep 17 00:00:00 2001 From: Germain Date: Tue, 9 Nov 2021 14:46:48 +0000 Subject: [PATCH] Getter for last thread reply (#2015) --- src/models/thread.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/models/thread.ts b/src/models/thread.ts index a1150d494..5fae43042 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -105,6 +105,15 @@ export class Thread extends EventEmitter { return this.timelineSet.findEventById(eventId); } + /** + * Return last reply to the thread + */ + public get lastReply(): MatrixEvent { + const threadReplies = this.events + .filter(event => event.isThreadRelation); + return threadReplies[threadReplies.length - 1]; + } + /** * Determines thread's ready status */