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

Listen for and update the notification state when they change #9438

Merged
merged 4 commits into from
Oct 18, 2022
Merged
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/stores/notifications/RoomNotificationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class RoomNotificationState extends NotificationState implements IDestroy
this.room.on(RoomEvent.Redaction, this.handleRoomEventUpdate);
this.room.on(RoomEvent.MyMembership, this.handleMembershipUpdate);
this.room.on(RoomEvent.LocalEchoUpdated, this.handleLocalEchoUpdated);
this.room.on(RoomEvent.UnreadNotifications, this.handleNotificationCountUpdate);
kegsay marked this conversation as resolved.
Show resolved Hide resolved
if (threadsState) {
threadsState.on(NotificationStateEvents.Update, this.handleThreadsUpdate);
}
Expand Down Expand Up @@ -83,6 +84,10 @@ export class RoomNotificationState extends NotificationState implements IDestroy
this.updateNotificationState();
};

private handleNotificationCountUpdate = () => {
this.updateNotificationState();
};

private onEventDecrypted = (event: MatrixEvent) => {
if (event.getRoomId() !== this.room.roomId) return; // ignore - not for us or notifications timeline

Expand Down