1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Add explicit options to disable pending events (#1993)

This commit is contained in:
Germain
2021-10-22 09:23:12 +01:00
committed by GitHub
parent 0385f265e8
commit 0c47e27f9f
3 changed files with 12 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ export class Thread extends EventEmitter {
/**
* A reference to all the events ID at the bottom of the threads
*/
public readonly timelineSet: EventTimelineSet;
public readonly timelineSet;
constructor(
events: MatrixEvent[] = [],
@@ -46,9 +46,14 @@ export class Thread extends EventEmitter {
public readonly client: MatrixClient,
) {
super();
this.timelineSet = new EventTimelineSet(null, {
if (events.length === 0) {
throw new Error("Can't create an empty thread");
}
this.timelineSet = new EventTimelineSet(this.room, {
unstableClientRelationAggregation: true,
timelineSupport: true,
pendingEvents: false,
});
events.forEach(event => this.addEvent(event));
}
@@ -93,14 +98,6 @@ export class Thread extends EventEmitter {
this.emit(ThreadEvent.Update, this);
}
private async decryptEvents(): Promise<void> {
await Promise.allSettled(
Array.from(this.timelineSet.getLiveTimeline().getEvents()).map(event => {
return this.client.decryptEventIfNeeded(event, {});
}),
);
}
/**
* Finds an event by ID in the current thread
*/