From c152bfd83ca1d6779c2952c01c07ff1b75abe339 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 2 May 2024 17:01:13 +0200 Subject: [PATCH] [Backport staging] TAC: Close Release Announcement when TAC button is clicked (#12485) --- .../ThreadsActivityCentre.tsx | 6 + .../spaces/ThreadsActivityCentre-test.tsx | 21 ++++ .../ThreadsActivityCentre-test.tsx.snap | 109 ++++++++++++++++-- 3 files changed, 127 insertions(+), 9 deletions(-) diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx index da2ce6be63e..4cc0102898e 100644 --- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx +++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx @@ -37,6 +37,7 @@ import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts"; import { ReleaseAnnouncement } from "../../../structures/ReleaseAnnouncement"; import { useIsReleaseAnnouncementOpen } from "../../../../hooks/useIsReleaseAnnouncementOpen"; import { useSettingValue } from "../../../../hooks/useSettings"; +import { ReleaseAnnouncementStore } from "../../../../stores/ReleaseAnnouncementStore"; interface ThreadsActivityCentreProps { /** @@ -84,6 +85,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen { + // Open the TAC after the release announcement closing + setOpen(true); + await ReleaseAnnouncementStore.instance.nextReleaseAnnouncement(); + }} /> ) : ( diff --git a/test/components/views/spaces/ThreadsActivityCentre-test.tsx b/test/components/views/spaces/ThreadsActivityCentre-test.tsx index 02d37b53af8..bf7defc83d5 100644 --- a/test/components/views/spaces/ThreadsActivityCentre-test.tsx +++ b/test/components/views/spaces/ThreadsActivityCentre-test.tsx @@ -118,6 +118,27 @@ describe("ThreadsActivityCentre", () => { expect(document.body).toMatchSnapshot(); }); + it("should render not display the tooltip when the release announcement is displayed", async () => { + // Enable release announcement + await SettingsStore.setValue("feature_release_announcement", null, SettingLevel.DEVICE, true); + + renderTAC(); + + // The tooltip should not be displayed + await userEvent.hover(getTACButton()); + expect(screen.queryByRole("tooltip")).toBeNull(); + }); + + it("should close the release announcement when the TAC button is clicked", async () => { + // Enable release announcement + await SettingsStore.setValue("feature_release_announcement", null, SettingLevel.DEVICE, true); + + renderTAC(); + await userEvent.click(getTACButton()); + expect(getTACMenu()).toBeInTheDocument(); + expect(document.body).toMatchSnapshot(); + }); + it("should render the threads activity centre button and the display label", async () => { renderTAC({ displayButtonLabel: true }); expect(getTACButton()).toBeInTheDocument(); diff --git a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap index 028011341e3..56bc5451f3e 100644 --- a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap @@ -2,7 +2,7 @@ exports[`ThreadsActivityCentre renders notifications matching the snapshot 1`] = ` `; +exports[`ThreadsActivityCentre should close the release announcement when the TAC button is clicked 1`] = ` + +