From a5e186b9786c387c999ecc70251ba01059add194 Mon Sep 17 00:00:00 2001 From: Germain Date: Thu, 31 Aug 2023 21:21:32 +0100 Subject: [PATCH 1/8] Move notifications bell back in labs --- src/components/views/rooms/RoomHeader.tsx | 22 +++++++++++++--------- src/i18n/strings/en_EN.json | 3 ++- src/settings/Settings.tsx | 8 ++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 05e649bddb9..21f6e4e9390 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -106,6 +106,8 @@ export default function RoomHeader({ room }: { room: Room }): JSX.Element { }, [room, directRoomsList]); const e2eStatus = useEncryptionStatus(client, room); + const notificationsEnabled = useFeatureEnabled("feature_notifications"); + return ( - { - showOrHidePanel(RightPanelPhases.NotificationPanel); - }} - title={_t("Notifications")} - > - - + {notificationsEnabled && ( + { + showOrHidePanel(RightPanelPhases.NotificationPanel); + }} + title={_t("Notifications")} + > + + + )} {!isDirectMessage && ( Date: Thu, 31 Aug 2023 21:57:45 +0100 Subject: [PATCH 2/8] Update tests --- test/components/views/rooms/RoomHeader-test.tsx | 4 ++++ .../views/rooms/__snapshots__/RoomHeader-test.tsx.snap | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/test/components/views/rooms/RoomHeader-test.tsx b/test/components/views/rooms/RoomHeader-test.tsx index abd0a93639a..f6bf6e52000 100644 --- a/test/components/views/rooms/RoomHeader-test.tsx +++ b/test/components/views/rooms/RoomHeader-test.tsx @@ -200,6 +200,10 @@ describe("RoomHeader", () => { }); it("opens the notifications panel", async () => { + jest.spyOn(SettingsStore, "getValue").mockImplementation((name: string) => { + if (name === "feature_notifications") return true; + }); + const { container } = render( , withClientContextRenderOptions(MatrixClientPeg.get()!), diff --git a/test/components/views/rooms/__snapshots__/RoomHeader-test.tsx.snap b/test/components/views/rooms/__snapshots__/RoomHeader-test.tsx.snap index bfcc9544543..f1e2b2081fe 100644 --- a/test/components/views/rooms/__snapshots__/RoomHeader-test.tsx.snap +++ b/test/components/views/rooms/__snapshots__/RoomHeader-test.tsx.snap @@ -62,13 +62,6 @@ exports[`RoomHeader does not show the face pile for DMs 1`] = ` >
- From 6b57ab53df669b416c71984978905e15120d348c Mon Sep 17 00:00:00 2001 From: Germain Date: Fri, 1 Sep 2023 07:50:18 +0100 Subject: [PATCH 3/8] Remove ReloadOnChangeController for feature_notifications --- src/settings/Settings.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index db3fc59eb0d..93486f26e10 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -558,7 +558,6 @@ export const SETTINGS: { [setting: string]: ISetting } = { displayName: _td("labs|notifications"), supportedLevels: LEVELS_FEATURE, default: false, - controller: new ReloadOnChangeController(), }, "useCompactLayout": { supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS, From de88a7c8dfca154bf99bddbc542ac033139c7932 Mon Sep 17 00:00:00 2001 From: Germain Date: Fri, 1 Sep 2023 07:56:29 +0100 Subject: [PATCH 4/8] Apply labs flag to legacy room header too --- .../views/right_panel/HeaderButtons.tsx | 8 +++++ .../right_panel/LegacyRoomHeaderButtons.tsx | 32 ++++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/components/views/right_panel/HeaderButtons.tsx b/src/components/views/right_panel/HeaderButtons.tsx index d13eb5d2d77..69ab3ea80f5 100644 --- a/src/components/views/right_panel/HeaderButtons.tsx +++ b/src/components/views/right_panel/HeaderButtons.tsx @@ -27,6 +27,7 @@ import { IRightPanelCardState } from "../../../stores/right-panel/RightPanelStor import { UPDATE_EVENT } from "../../../stores/AsyncStore"; import { NotificationColor } from "../../../stores/notifications/NotificationColor"; import { ActionPayload } from "../../../dispatcher/payloads"; +import SettingsStore from "../../../settings/SettingsStore"; export enum HeaderKind { Room = "room", @@ -37,6 +38,7 @@ interface IState { phase: RightPanelPhases | null; threadNotificationColor: NotificationColor; globalNotificationColor: NotificationColor; + notificationsEnabled?: boolean; } interface IProps {} @@ -44,6 +46,7 @@ interface IProps {} export default abstract class HeaderButtons

extends React.Component { private unmounted = false; private dispatcherRef?: string = undefined; + private readonly watcherRef: string; public constructor(props: IProps & P, kind: HeaderKind) { super(props); @@ -54,7 +57,11 @@ export default abstract class HeaderButtons

extends React.Component + this.setState({ notificationsEnabled: value }), + ); } public componentDidMount(): void { @@ -66,6 +73,7 @@ export default abstract class HeaderButtons

extends React.Component { , ); - rightPanelPhaseButtons.set( - RightPanelPhases.NotificationPanel, - - {this.globalNotificationState.color === NotificationColor.Red ? ( - - ) : null} - , - ); + if (this.state.notificationsEnabled) { + rightPanelPhaseButtons.set( + RightPanelPhases.NotificationPanel, + + {this.globalNotificationState.color === NotificationColor.Red ? ( + + ) : null} + , + ); + } rightPanelPhaseButtons.set( RightPanelPhases.RoomSummary, Date: Fri, 1 Sep 2023 08:33:03 +0100 Subject: [PATCH 5/8] Snapshot updates --- .../__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/components/views/right_panel/__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap b/test/components/views/right_panel/__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap index bd706048be2..6dbe9ed2e3a 100644 --- a/test/components/views/right_panel/__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap +++ b/test/components/views/right_panel/__snapshots__/LegacyRoomHeaderButtons-test.tsx.snap @@ -17,13 +17,6 @@ exports[`LegacyRoomHeaderButtons-test.tsx should render 1`] = ` role="button" tabindex="0" /> -

Date: Fri, 1 Sep 2023 11:00:34 +0100 Subject: [PATCH 6/8] Update wording for the notifications labs flag --- src/i18n/strings/en_EN.json | 3 ++- src/settings/Settings.tsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 6015df0ec62..c9abf5fc985 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -869,7 +869,8 @@ "intentional_mentions": "Enable intentional mentions", "ask_to_join": "Enable ask to join", "new_room_decoration_ui": "Under active development, new room header & details interface", - "notifications": "Notifications panel" + "notifications": "Enable the notifications panel in the room header", + "unrealiable_e2e": "Unreliable in encrypted rooms" }, "Thank you for trying the beta, please go into as much detail as you can so we can improve it.": "Thank you for trying the beta, please go into as much detail as you can so we can improve it.", "Notification Settings": "Notification Settings", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 93486f26e10..0f60b50c47b 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -556,6 +556,7 @@ export const SETTINGS: { [setting: string]: ISetting } = { isFeature: true, labsGroup: LabGroup.Messaging, displayName: _td("labs|notifications"), + description: _td("labs|unrealiable_e2e"), supportedLevels: LEVELS_FEATURE, default: false, }, From 610f9396bb68b852b786be41d117f588ff2b8a33 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 14 Sep 2023 16:55:14 +0530 Subject: [PATCH 7/8] Fix broken tests --- cypress/e2e/right-panel/notification-panel.spec.ts | 1 + cypress/e2e/room/room-header.spec.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cypress/e2e/right-panel/notification-panel.spec.ts b/cypress/e2e/right-panel/notification-panel.spec.ts index 4068285070b..75a80abaf3a 100644 --- a/cypress/e2e/right-panel/notification-panel.spec.ts +++ b/cypress/e2e/right-panel/notification-panel.spec.ts @@ -38,6 +38,7 @@ describe("NotificationPanel", () => { }); it("should render empty state", () => { + cy.enableLabsFeature("feature_notifications"); cy.viewRoomByName(ROOM_NAME); cy.findByRole("button", { name: "Notifications" }).click(); diff --git a/cypress/e2e/room/room-header.spec.ts b/cypress/e2e/room/room-header.spec.ts index 835fb2bb3e3..d92d5051678 100644 --- a/cypress/e2e/room/room-header.spec.ts +++ b/cypress/e2e/room/room-header.spec.ts @@ -36,6 +36,7 @@ describe("Room Header", () => { }); it("should render default buttons properly", () => { + cy.enableLabsFeature("feature_notifications"); cy.createRoom({ name: "Test Room" }).viewRoomByName("Test Room"); cy.get(".mx_LegacyRoomHeader").within(() => { @@ -79,6 +80,7 @@ describe("Room Header", () => { }); it("should render a very long room name without collapsing the buttons", () => { + cy.enableLabsFeature("feature_notifications"); const LONG_ROOM_NAME = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore " + "et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " + @@ -109,6 +111,7 @@ describe("Room Header", () => { }); it("should have buttons highlighted by being clicked", () => { + cy.enableLabsFeature("feature_notifications"); cy.createRoom({ name: "Test Room" }).viewRoomByName("Test Room"); cy.get(".mx_LegacyRoomHeader").within(() => { @@ -142,6 +145,7 @@ describe("Room Header", () => { }; it("should render buttons for room options, beta pill, invite, chat, and room info", () => { + cy.enableLabsFeature("feature_notifications"); createVideoRoom(); cy.get(".mx_LegacyRoomHeader").within(() => { From d5d4b528d5fe6918aaed8fca6aad4621295febeb Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 15 Sep 2023 16:45:51 +0530 Subject: [PATCH 8/8] Remove unused import --- src/components/views/right_panel/HeaderButtons.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/right_panel/HeaderButtons.tsx b/src/components/views/right_panel/HeaderButtons.tsx index a9538c415fa..dbdd2f10b5b 100644 --- a/src/components/views/right_panel/HeaderButtons.tsx +++ b/src/components/views/right_panel/HeaderButtons.tsx @@ -25,7 +25,6 @@ import RightPanelStore from "../../../stores/right-panel/RightPanelStore"; import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases"; import { UPDATE_EVENT } from "../../../stores/AsyncStore"; import { NotificationColor } from "../../../stores/notifications/NotificationColor"; -import { ActionPayload } from "../../../dispatcher/payloads"; import SettingsStore from "../../../settings/SettingsStore"; export enum HeaderKind {