From 782a555e44de49626837604020b05d1ad47b5a25 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 30 Jun 2020 13:45:10 -0600 Subject: [PATCH] Make badges represent old list behaviour Fixes https://github.com/vector-im/riot-web/issues/14160 --- src/components/views/rooms/NotificationBadge.tsx | 9 ++++++--- src/stores/notifications/TagSpecificNotificationState.ts | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/NotificationBadge.tsx b/src/components/views/rooms/NotificationBadge.tsx index 1bb72d02c3..dfc02176c6 100644 --- a/src/components/views/rooms/NotificationBadge.tsx +++ b/src/components/views/rooms/NotificationBadge.tsx @@ -86,11 +86,14 @@ export default class NotificationBadge extends React.PureComponent= NotificationColor.Red; const hasCount = this.props.notification.color >= NotificationColor.Grey; - const hasUnread = this.props.notification.color >= NotificationColor.Bold; - const couldBeEmpty = (!this.state.showCounts || hasUnread) && !hasNotif; - let isEmptyBadge = couldBeEmpty && (!this.state.showCounts || !hasCount); + const hasAnySymbol = this.props.notification.symbol || this.props.notification.count > 0; + let isEmptyBadge = !hasAnySymbol || !hasCount; if (this.props.forceCount) { isEmptyBadge = false; if (!hasCount) return null; // Can't render a badge diff --git a/src/stores/notifications/TagSpecificNotificationState.ts b/src/stores/notifications/TagSpecificNotificationState.ts index 02d8717fee..b443f4633b 100644 --- a/src/stores/notifications/TagSpecificNotificationState.ts +++ b/src/stores/notifications/TagSpecificNotificationState.ts @@ -16,7 +16,7 @@ limitations under the License. import { NotificationColor } from "./NotificationColor"; import { Room } from "matrix-js-sdk/src/models/room"; -import { DefaultTagID, TagID } from "../room-list/models"; +import { TagID } from "../room-list/models"; import { RoomNotificationState } from "./RoomNotificationState"; export class TagSpecificNotificationState extends RoomNotificationState { @@ -24,7 +24,8 @@ export class TagSpecificNotificationState extends RoomNotificationState { // @ts-ignore - TS wants this to be a string key, but we know better [tagId: TagID]: NotificationColor, } = { - [DefaultTagID.DM]: NotificationColor.Red, + // TODO: Update for FTUE Notifications: https://github.com/vector-im/riot-web/issues/14261 + //[DefaultTagID.DM]: NotificationColor.Red, }; private readonly colorWhenNotIdle?: NotificationColor;