diff --git a/src/stores/notifications/RoomNotificationStateStore.ts b/src/stores/notifications/RoomNotificationStateStore.ts index ed74d3bae6..91147b0cf4 100644 --- a/src/stores/notifications/RoomNotificationStateStore.ts +++ b/src/stores/notifications/RoomNotificationStateStore.ts @@ -22,15 +22,12 @@ import { FetchRoomFn, ListNotificationState } from "./ListNotificationState"; import { Room } from "matrix-js-sdk/src/models/room"; import { RoomNotificationState } from "./RoomNotificationState"; -const INSPECIFIC_TAG = "INSPECIFIC_TAG"; -type INSPECIFIC_TAG = "INSPECIFIC_TAG"; - interface IState {} export class RoomNotificationStateStore extends AsyncStoreWithClient { private static internalInstance = new RoomNotificationStateStore(); - private roomMap = new Map>(); + private roomMap = new Map(); private constructor() { super(defaultDispatcher, {}); @@ -49,7 +46,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { // TODO: Update if/when invites move out of the room list. const useTileCount = tagId === DefaultTagID.Invite; const getRoomFn: FetchRoomFn = (room: Room) => { - return this.getRoomState(room, tagId); + return this.getRoomState(room); }; return new ListNotificationState(useTileCount, tagId, getRoomFn); } @@ -59,22 +56,13 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { * attempt to destroy the returned state as it may be shared with other * consumers. * @param room The room to get the notification state for. - * @param inTagId Optional tag ID to scope the notification state to. * @returns The room's notification state. */ - public getRoomState(room: Room, inTagId?: TagID): RoomNotificationState { + public getRoomState(room: Room): RoomNotificationState { if (!this.roomMap.has(room)) { - this.roomMap.set(room, new Map()); + this.roomMap.set(room, new RoomNotificationState(room)); } - - const targetTag = inTagId ? inTagId : INSPECIFIC_TAG; - - const forRoomMap = this.roomMap.get(room); - if (!forRoomMap.has(targetTag)) { - forRoomMap.set(inTagId ? inTagId : INSPECIFIC_TAG, new RoomNotificationState(room)); - } - - return forRoomMap.get(targetTag); + return this.roomMap.get(room); } public static get instance(): RoomNotificationStateStore { @@ -82,10 +70,8 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { } protected async onNotReady(): Promise { - for (const roomMap of this.roomMap.values()) { - for (const roomState of roomMap.values()) { - roomState.destroy(); - } + for (const roomState of this.roomMap.values()) { + roomState.destroy(); } }