mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
Make badges represent old list behaviour
Fixes https://github.com/vector-im/riot-web/issues/14160
This commit is contained in:
parent
393eaf84c3
commit
782a555e44
2 changed files with 9 additions and 5 deletions
|
@ -86,11 +86,14 @@ export default class NotificationBadge extends React.PureComponent<IProps, IStat
|
|||
// Don't show a badge if we don't need to
|
||||
if (this.props.notification.color <= NotificationColor.None) return null;
|
||||
|
||||
// TODO: Update these booleans for FTUE Notifications: https://github.com/vector-im/riot-web/issues/14261
|
||||
// As of writing, that is "if red, show count always" and "optionally show counts instead of dots".
|
||||
// See git diff for what that boolean state looks like.
|
||||
// XXX: We ignore this.state.showCounts (the setting which controls counts vs dots).
|
||||
const hasNotif = this.props.notification.color >= 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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue