From cd39d91c15a91b8a1be930ef29d95798896a1110 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 9 Jul 2024 10:45:48 +0100 Subject: [PATCH] Promote new room header from labs to Beta (#12739) * Promote new room header from labs to Beta Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix reload warning Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update snapshot Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/i18n/strings/en_EN.json | 4 +- src/settings/Settings.tsx | 8 ++- src/settings/SettingsStore.ts | 8 ++- .../LabsUserSettingsTab-test.tsx.snap | 55 +++++++++++++++++++ test/settings/SettingsStore-test.ts | 2 +- 5 files changed, 71 insertions(+), 6 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b8d3cf113f..afb381f6a1 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1452,7 +1452,9 @@ "location_share_live_description": "Temporary implementation. Locations persist in room history.", "mjolnir": "New ways to ignore people", "msc3531_hide_messages_pending_moderation": "Let moderators hide messages pending moderation.", - "new_room_decoration_ui": "Under active development, new room header & details interface", + "new_room_decoration_ui": "New room header", + "new_room_decoration_ui_beta_caption": "A new look for your rooms with a simpler, cleaner and more accessible room header.", + "new_room_decoration_ui_beta_title": "Room header", "notification_settings": "New Notification Settings", "notification_settings_beta_caption": "Introducing a simpler way to change your notification settings. Customize your %(brand)s, just the way you like.", "notification_settings_beta_title": "Notification Settings", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index fbdd20633e..130eb70bd7 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -589,11 +589,13 @@ export const SETTINGS: { [setting: string]: ISetting } = { isFeature: true, labsGroup: LabGroup.Rooms, displayName: _td("labs|new_room_decoration_ui"), - description: _td("labs|under_active_development"), - supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG_PRIORITISED, - supportedLevelsAreOrdered: true, + supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG, default: false, controller: new ReloadOnChangeController(), + betaInfo: { + title: _td("labs|new_room_decoration_ui_beta_title"), + caption: () =>

{_t("labs|new_room_decoration_ui_beta_caption")}

, + }, }, "feature_notifications": { isFeature: true, diff --git a/src/settings/SettingsStore.ts b/src/settings/SettingsStore.ts index 276f00282b..a746485368 100644 --- a/src/settings/SettingsStore.ts +++ b/src/settings/SettingsStore.ts @@ -35,6 +35,7 @@ import SettingsHandler from "./handlers/SettingsHandler"; import { SettingUpdatedPayload } from "../dispatcher/payloads/SettingUpdatedPayload"; import { Action } from "../dispatcher/actions"; import PlatformSettingsHandler from "./handlers/PlatformSettingsHandler"; +import ReloadOnChangeController from "./controllers/ReloadOnChangeController"; // Convert the settings to easier to manage objects for the handlers const defaultSettings: Record = {}; @@ -316,7 +317,12 @@ export default class SettingsStore { SettingsStore.isFeature(settingName) && SettingsStore.getValueAt(SettingLevel.CONFIG, settingName, null, true, true) !== false ) { - return SETTINGS[settingName]?.betaInfo; + const betaInfo = SETTINGS[settingName]!.betaInfo; + if (betaInfo) { + betaInfo.requiresRefresh = + betaInfo.requiresRefresh ?? SETTINGS[settingName]!.controller instanceof ReloadOnChangeController; + } + return betaInfo; } } diff --git a/test/components/views/settings/tabs/user/__snapshots__/LabsUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/LabsUserSettingsTab-test.tsx.snap index 4e65f7b61f..51ab465503 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/LabsUserSettingsTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/LabsUserSettingsTab-test.tsx.snap @@ -129,6 +129,61 @@ exports[` renders settings marked as beta as beta cards 1 +
+
+
+

+ + Room header + + + Beta + +

+
+

+ A new look for your rooms with a simpler, cleaner and more accessible room header. +

+
+
+
+ Join the beta +
+
+
+ Joining the beta will reload BrandedClient. +
+
+
+ +
+
+
`; diff --git a/test/settings/SettingsStore-test.ts b/test/settings/SettingsStore-test.ts index e1c27ab309..64c63d1b56 100644 --- a/test/settings/SettingsStore-test.ts +++ b/test/settings/SettingsStore-test.ts @@ -31,7 +31,7 @@ const TEST_DATA = [ /** * An existing setting that has {@link IBaseSetting#supportedLevelsAreOrdered} set to true. */ -const SETTING_NAME_WITH_CONFIG_OVERRIDE = "feature_new_room_decoration_ui"; +const SETTING_NAME_WITH_CONFIG_OVERRIDE = "feature_msc3531_hide_messages_pending_moderation"; describe("SettingsStore", () => { let platformSettings: Record;