From 50f35a2d68fa0a0ab8db58a493269c1ae15c488b Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 30 Apr 2024 18:30:25 +0200 Subject: [PATCH 1/2] Close RA when TAC button is clicked --- .../ThreadsActivityCentre.tsx | 6 ++ .../spaces/ThreadsActivityCentre-test.tsx | 10 ++ .../ThreadsActivityCentre-test.tsx.snap | 91 +++++++++++++++++++ 3 files changed, 107 insertions(+) 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..e2f1be40f45 100644 --- a/test/components/views/spaces/ThreadsActivityCentre-test.tsx +++ b/test/components/views/spaces/ThreadsActivityCentre-test.tsx @@ -118,6 +118,16 @@ describe("ThreadsActivityCentre", () => { expect(document.body).toMatchSnapshot(); }); + 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..832fa2bdec9 100644 --- a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap @@ -125,6 +125,97 @@ exports[`ThreadsActivityCentre renders notifications matching the snapshot 1`] = `; +exports[`ThreadsActivityCentre should close the release announcement when the TAC button is clicked 1`] = ` + +