Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 249474b

Browse files
author
Germain
authored
Only render NotificationBadge when needed (#9493)
1 parent 6e73a85 commit 249474b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cypress/e2e/sliding-sync/sliding-sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ describe("Sliding Sync", () => {
235235
"Test Room", "Dummy",
236236
]);
237237

238-
cy.contains(".mx_RoomTile", "Test Room").get(".mx_NotificationBadge").should("not.be.visible");
238+
cy.contains(".mx_RoomTile", "Test Room").get(".mx_NotificationBadge").should("not.exist");
239239
});
240240

241241
it("should update user settings promptly", () => {

src/components/views/rooms/NotificationBadge.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ export default class NotificationBadge extends React.PureComponent<XOR<IProps, I
111111

112112
public render(): React.ReactElement {
113113
/* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
114-
const { notification, showUnsentTooltip, onClick } = this.props;
114+
const { notification, showUnsentTooltip, forceCount, onClick } = this.props;
115+
116+
if (notification.isIdle) return null;
117+
if (forceCount) {
118+
if (!notification.hasUnreadCount) return null; // Can't render a badge
119+
}
115120

116121
let label: string;
117122
let tooltip: JSX.Element;

0 commit comments

Comments
 (0)