From a4f7f666cff394e5ca062306f1a269f05390aea4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 17 Jul 2020 16:20:19 -0600 Subject: [PATCH] Remove useless TagSpecificNotificationState FTUE Notifications won't be needing this. --- .../RoomNotificationStateStore.ts | 7 +-- .../TagSpecificNotificationState.ts | 46 ------------------- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 src/stores/notifications/TagSpecificNotificationState.ts diff --git a/src/stores/notifications/RoomNotificationStateStore.ts b/src/stores/notifications/RoomNotificationStateStore.ts index 311dcdf2d6..ed74d3bae6 100644 --- a/src/stores/notifications/RoomNotificationStateStore.ts +++ b/src/stores/notifications/RoomNotificationStateStore.ts @@ -21,7 +21,6 @@ import { DefaultTagID, TagID } from "../room-list/models"; import { FetchRoomFn, ListNotificationState } from "./ListNotificationState"; import { Room } from "matrix-js-sdk/src/models/room"; import { RoomNotificationState } from "./RoomNotificationState"; -import { TagSpecificNotificationState } from "./TagSpecificNotificationState"; const INSPECIFIC_TAG = "INSPECIFIC_TAG"; type INSPECIFIC_TAG = "INSPECIFIC_TAG"; @@ -72,11 +71,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient { const forRoomMap = this.roomMap.get(room); if (!forRoomMap.has(targetTag)) { - if (inTagId) { - forRoomMap.set(inTagId, new TagSpecificNotificationState(room, inTagId)); - } else { - forRoomMap.set(INSPECIFIC_TAG, new RoomNotificationState(room)); - } + forRoomMap.set(inTagId ? inTagId : INSPECIFIC_TAG, new RoomNotificationState(room)); } return forRoomMap.get(targetTag); diff --git a/src/stores/notifications/TagSpecificNotificationState.ts b/src/stores/notifications/TagSpecificNotificationState.ts deleted file mode 100644 index b443f4633b..0000000000 --- a/src/stores/notifications/TagSpecificNotificationState.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2020 The Matrix.org Foundation C.I.C. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import { NotificationColor } from "./NotificationColor"; -import { Room } from "matrix-js-sdk/src/models/room"; -import { TagID } from "../room-list/models"; -import { RoomNotificationState } from "./RoomNotificationState"; - -export class TagSpecificNotificationState extends RoomNotificationState { - private static TAG_TO_COLOR: { - // @ts-ignore - TS wants this to be a string key, but we know better - [tagId: TagID]: NotificationColor, - } = { - // TODO: Update for FTUE Notifications: https://github.com/vector-im/riot-web/issues/14261 - //[DefaultTagID.DM]: NotificationColor.Red, - }; - - private readonly colorWhenNotIdle?: NotificationColor; - - constructor(room: Room, tagId: TagID) { - super(room); - - const specificColor = TagSpecificNotificationState.TAG_TO_COLOR[tagId]; - if (specificColor) this.colorWhenNotIdle = specificColor; - } - - public get color(): NotificationColor { - if (!this.colorWhenNotIdle) return super.color; - - if (super.color !== NotificationColor.None) return this.colorWhenNotIdle; - return super.color; - } -}