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

Commit

Permalink
Only render NotificationBadge when needed (#9493)
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain authored Oct 25, 2022
1 parent 6e73a85 commit 249474b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/sliding-sync/sliding-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
7 changes: 6 additions & 1 deletion src/components/views/rooms/NotificationBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 249474b

Please sign in to comment.