1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-07 05:22:15 +03:00

Make threads reply chain filter out local event ID (#2129)

This commit is contained in:
Germain
2022-01-25 10:51:12 +00:00
committed by GitHub
parent a34426a7f6
commit 8434f29c54

View File

@@ -138,10 +138,13 @@ export class Thread extends TypedEventEmitter<ThreadEvent> {
/** /**
* Return last reply to the thread * Return last reply to the thread
*/ */
public get lastReply(): MatrixEvent { public lastReply(matches: (ev: MatrixEvent) => boolean = () => true): MatrixEvent {
const threadReplies = this.events for (let i = this.events.length - 1; i >= 0; i--) {
.filter(event => event.isThreadRelation); const event = this.events[i];
return threadReplies[threadReplies.length - 1]; if (event.isThreadRelation && matches(event)) {
return event;
}
}
} }
/** /**