From 727c88568737b1978698628c7f9e7010c6e4a530 Mon Sep 17 00:00:00 2001 From: Kerry Date: Tue, 9 May 2023 08:58:27 +1200 Subject: [PATCH] Fix: Threads button is highlighted when I create a new room (#10819) * fix thread button highlight logic * lint --- src/components/views/right_panel/RoomHeaderButtons.tsx | 2 +- test/components/views/right_panel/RoomHeaderButtons-test.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/views/right_panel/RoomHeaderButtons.tsx b/src/components/views/right_panel/RoomHeaderButtons.tsx index 79bc57515f..0826548664 100644 --- a/src/components/views/right_panel/RoomHeaderButtons.tsx +++ b/src/components/views/right_panel/RoomHeaderButtons.tsx @@ -301,7 +301,7 @@ export default class RoomHeaderButtons extends HeaderButtons { title={_t("Threads")} onClick={this.onThreadsPanelClicked} isHighlighted={this.isPhase(RoomHeaderButtons.THREAD_PHASES)} - isUnread={this.state.threadNotificationColor > 0} + isUnread={this.state.threadNotificationColor > NotificationColor.None} > , diff --git a/test/components/views/right_panel/RoomHeaderButtons-test.tsx b/test/components/views/right_panel/RoomHeaderButtons-test.tsx index 89f7f87b15..a7f932b22d 100644 --- a/test/components/views/right_panel/RoomHeaderButtons-test.tsx +++ b/test/components/views/right_panel/RoomHeaderButtons-test.tsx @@ -70,8 +70,10 @@ describe("RoomHeaderButtons-test.tsx", function () { it("thread notification does change the thread button", () => { const { container } = getComponent(room); + expect(getThreadButton(container)!.className.includes("mx_RightPanel_headerButton_unread")).toBeFalsy(); room.setThreadUnreadNotificationCount("$123", NotificationCountType.Total, 1); + expect(getThreadButton(container)!.className.includes("mx_RightPanel_headerButton_unread")).toBeTruthy(); expect(isIndicatorOfType(container, "gray")).toBe(true); room.setThreadUnreadNotificationCount("$123", NotificationCountType.Highlight, 1);