Skip to content

Commit

Permalink
Allow removing the relationship of an event to a thread
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Oct 11, 2022
1 parent bc070f0 commit 144f171
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/models/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1543,10 +1543,15 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
/**
* @experimental
*/
public setThread(thread: Thread): void {
public setThread(thread: Thread | null): void {
if (this.thread) {
this.reEmitter.stopReEmitting(this.thread, [ThreadEvent.Update]);
}
this.thread = thread;
this.setThreadId(thread.id);
this.reEmitter.reEmit(thread, [ThreadEvent.Update]);
this.setThreadId(thread?.id);
if (thread) {
this.reEmitter.reEmit(thread, [ThreadEvent.Update]);
}
}

/**
Expand Down

0 comments on commit 144f171

Please sign in to comment.