Skip to content

Emit thread update after event decryption #2040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ export class Room extends EventEmitter {
// types X Y Z to the timeline".
this.addLiveEvent(events[i], duplicateStrategy, fromCache);
const thread = this.threads.get(events[i].getId());
if (thread && !thread.ready) {
if (thread) {
thread.addEvent(events[i], true);
}
}
Expand Down
11 changes: 1 addition & 10 deletions src/models/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ export class Thread extends TypedEventEmitter<ThreadEvent> {
this._currentUserParticipated = true;
}

if (this.ready) {
this.client.decryptEventIfNeeded(event, {});
}
await this.client.decryptEventIfNeeded(event, {});
this.emit(ThreadEvent.Update, this);
}

Expand All @@ -129,13 +127,6 @@ export class Thread extends TypedEventEmitter<ThreadEvent> {
return threadReplies[threadReplies.length - 1];
}

/**
* Determines thread's ready status
*/
public get ready(): boolean {
return this.rootEvent !== undefined;
}

/**
* The thread ID, which is the same as the root event ID
*/
Expand Down