diff --git a/src/models/thread.ts b/src/models/thread.ts index 5e0c0ef47..2e9080c88 100644 --- a/src/models/thread.ts +++ b/src/models/thread.ts @@ -40,6 +40,8 @@ export class Thread extends BaseModel { */ public readonly timelineSet; + private _currentUserParticipated = false; + constructor( events: MatrixEvent[] = [], public readonly room: Room, @@ -92,6 +94,10 @@ export class Thread extends BaseModel { roomState, ); + if (!this._currentUserParticipated && event.getSender() === this.client.getUserId()) { + this._currentUserParticipated = true; + } + if (this.ready) { this.client.decryptEventIfNeeded(event, {}); } @@ -150,17 +156,6 @@ export class Thread extends BaseModel { .length; } - /** - * A set of mxid participating to the thread - */ - public get participants(): Set { - const participants = new Set(); - this.events.forEach(event => { - participants.add(event.getSender()); - }); - return participants; - } - /** * A getter for the last event added to the thread */ @@ -183,4 +178,8 @@ export class Thread extends BaseModel { public has(eventId: string): boolean { return this.timelineSet.findEventById(eventId) instanceof MatrixEvent; } + + public get hasCurrentUserParticipated(): boolean { + return this._currentUserParticipated; + } }