mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
Only render NotificationBadge when needed (#9493)
This commit is contained in:
parent
6e73a853a8
commit
249474b430
@ -235,7 +235,7 @@ describe("Sliding Sync", () => {
|
||||
"Test Room", "Dummy",
|
||||
]);
|
||||
|
||||
cy.contains(".mx_RoomTile", "Test Room").get(".mx_NotificationBadge").should("not.be.visible");
|
||||
cy.contains(".mx_RoomTile", "Test Room").get(".mx_NotificationBadge").should("not.exist");
|
||||
});
|
||||
|
||||
it("should update user settings promptly", () => {
|
||||
|
@ -111,7 +111,12 @@ export default class NotificationBadge extends React.PureComponent<XOR<IProps, I
|
||||
|
||||
public render(): React.ReactElement {
|
||||
/* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
|
||||
const { notification, showUnsentTooltip, onClick } = this.props;
|
||||
const { notification, showUnsentTooltip, forceCount, onClick } = this.props;
|
||||
|
||||
if (notification.isIdle) return null;
|
||||
if (forceCount) {
|
||||
if (!notification.hasUnreadCount) return null; // Can't render a badge
|
||||
}
|
||||
|
||||
let label: string;
|
||||
let tooltip: JSX.Element;
|
||||
|
Loading…
Reference in New Issue
Block a user