From d7bc23c38268af17c43eebee91aced18bcfe5ed1 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 8 May 2023 10:59:45 +1200 Subject: [PATCH 1/2] fix thread button highlight logic --- src/components/views/right_panel/RoomHeaderButtons.tsx | 2 +- test/components/views/right_panel/RoomHeaderButtons-test.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/RoomHeaderButtons.tsx b/src/components/views/right_panel/RoomHeaderButtons.tsx index 79bc57515fd..0826548664c 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 89f7f87b153..e10396b2422 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); From e4cc7c5d066689dc41df9116d94cd9a141596739 Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Mon, 8 May 2023 11:12:36 +1200 Subject: [PATCH 2/2] lint --- .../components/views/right_panel/RoomHeaderButtons-test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/components/views/right_panel/RoomHeaderButtons-test.tsx b/test/components/views/right_panel/RoomHeaderButtons-test.tsx index e10396b2422..a7f932b22db 100644 --- a/test/components/views/right_panel/RoomHeaderButtons-test.tsx +++ b/test/components/views/right_panel/RoomHeaderButtons-test.tsx @@ -70,10 +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(); - + 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(getThreadButton(container)!.className.includes("mx_RightPanel_headerButton_unread")).toBeTruthy(); expect(isIndicatorOfType(container, "gray")).toBe(true); room.setThreadUnreadNotificationCount("$123", NotificationCountType.Highlight, 1);