Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
properly listen to thread deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Oct 17, 2022
1 parent 6a002b1 commit 3c11605
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ export class UnwrappedEventTile extends React.Component<IProps, IState> {

const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
room?.off(ThreadEvent.New, this.onNewThread);
room?.off(ThreadEvent.Delete, this.onThreadDeleted);
if (this.threadState) {
this.threadState.off(NotificationStateEvents.Update, this.onThreadStateUpdate);
}
Expand All @@ -494,6 +495,16 @@ export class UnwrappedEventTile extends React.Component<IProps, IState> {
this.updateThread(thread);
const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
room.off(ThreadEvent.New, this.onNewThread);
room.on(ThreadEvent.Delete, this.onThreadDeleted);
}
};

private onThreadDeleted = (thread: Thread) => {
if (thread.id === this.props.mxEvent.getId()) {
this.updateThread(thread);
const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
room.on(ThreadEvent.New, this.onNewThread);
room.off(ThreadEvent.Delete, this.onThreadDeleted);
}
};

Expand Down

0 comments on commit 3c11605

Please sign in to comment.