Fix: Threads button is highlighted when I create a new room (#10819)

* fix thread button highlight logic

* lint
This commit is contained in:
Kerry 2023-05-09 08:58:27 +12:00 committed by GitHub
parent 81a23accd0
commit 727c885687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -301,7 +301,7 @@ export default class RoomHeaderButtons extends HeaderButtons<IProps> {
title={_t("Threads")} title={_t("Threads")}
onClick={this.onThreadsPanelClicked} onClick={this.onThreadsPanelClicked}
isHighlighted={this.isPhase(RoomHeaderButtons.THREAD_PHASES)} isHighlighted={this.isPhase(RoomHeaderButtons.THREAD_PHASES)}
isUnread={this.state.threadNotificationColor > 0} isUnread={this.state.threadNotificationColor > NotificationColor.None}
> >
<UnreadIndicator color={this.state.threadNotificationColor} /> <UnreadIndicator color={this.state.threadNotificationColor} />
</HeaderButton>, </HeaderButton>,

View File

@ -70,8 +70,10 @@ describe("RoomHeaderButtons-test.tsx", function () {
it("thread notification does change the thread button", () => { it("thread notification does change the thread button", () => {
const { container } = getComponent(room); const { container } = getComponent(room);
expect(getThreadButton(container)!.className.includes("mx_RightPanel_headerButton_unread")).toBeFalsy();
room.setThreadUnreadNotificationCount("$123", NotificationCountType.Total, 1); room.setThreadUnreadNotificationCount("$123", NotificationCountType.Total, 1);
expect(getThreadButton(container)!.className.includes("mx_RightPanel_headerButton_unread")).toBeTruthy();
expect(isIndicatorOfType(container, "gray")).toBe(true); expect(isIndicatorOfType(container, "gray")).toBe(true);
room.setThreadUnreadNotificationCount("$123", NotificationCountType.Highlight, 1); room.setThreadUnreadNotificationCount("$123", NotificationCountType.Highlight, 1);