mirror of https://github.com/vector-im/riot-web
Make badges represent old list behaviour
Fixes https://github.com/vector-im/riot-web/issues/14160pull/21833/head
parent
393eaf84c3
commit
782a555e44
|
@ -86,11 +86,14 @@ export default class NotificationBadge extends React.PureComponent<IProps, IStat
|
||||||
// Don't show a badge if we don't need to
|
// Don't show a badge if we don't need to
|
||||||
if (this.props.notification.color <= NotificationColor.None) return null;
|
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 hasNotif = this.props.notification.color >= NotificationColor.Red;
|
||||||
const hasCount = this.props.notification.color >= NotificationColor.Grey;
|
const hasCount = this.props.notification.color >= NotificationColor.Grey;
|
||||||
const hasUnread = this.props.notification.color >= NotificationColor.Bold;
|
const hasAnySymbol = this.props.notification.symbol || this.props.notification.count > 0;
|
||||||
const couldBeEmpty = (!this.state.showCounts || hasUnread) && !hasNotif;
|
let isEmptyBadge = !hasAnySymbol || !hasCount;
|
||||||
let isEmptyBadge = couldBeEmpty && (!this.state.showCounts || !hasCount);
|
|
||||||
if (this.props.forceCount) {
|
if (this.props.forceCount) {
|
||||||
isEmptyBadge = false;
|
isEmptyBadge = false;
|
||||||
if (!hasCount) return null; // Can't render a badge
|
if (!hasCount) return null; // Can't render a badge
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import { NotificationColor } from "./NotificationColor";
|
import { NotificationColor } from "./NotificationColor";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
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";
|
import { RoomNotificationState } from "./RoomNotificationState";
|
||||||
|
|
||||||
export class TagSpecificNotificationState extends 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
|
// @ts-ignore - TS wants this to be a string key, but we know better
|
||||||
[tagId: TagID]: NotificationColor,
|
[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;
|
private readonly colorWhenNotIdle?: NotificationColor;
|
||||||
|
|
Loading…
Reference in New Issue