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

Only render NotificationBadge when needed #9493

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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