From fcbcc62ee99c19ed77fb6211e95865b456ad3940 Mon Sep 17 00:00:00 2001 From: John Tore Simonsen Date: Thu, 28 Nov 2024 13:50:53 +0100 Subject: [PATCH] add feature flag for "Leave Space" --- .../views/spaces/SpaceSettingsGeneralTab.tsx | 25 +++++++++++-------- src/settings/Settings.tsx | 4 +++ src/settings/UIFeature.ts | 1 + 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/components/views/spaces/SpaceSettingsGeneralTab.tsx b/src/components/views/spaces/SpaceSettingsGeneralTab.tsx index 03f08557ca7..774636bd53c 100644 --- a/src/components/views/spaces/SpaceSettingsGeneralTab.tsx +++ b/src/components/views/spaces/SpaceSettingsGeneralTab.tsx @@ -28,6 +28,8 @@ import { getTopic } from "../../../hooks/room/useTopic"; import SettingsTab from "../settings/tabs/SettingsTab"; import { SettingsSection } from "../settings/shared/SettingsSection"; import SettingsSubsection from "../settings/shared/SettingsSubsection"; +import SettingsStore from "../../../settings/SettingsStore"; +import { UIFeature } from "../../../settings/UIFeature"; interface IProps { matrixClient: MatrixClient; @@ -125,17 +127,18 @@ const SpaceSettingsGeneralTab: React.FC = ({ matrixClient: cli, space }) {busy ? _t("common|saving") : _t("room_settings|general|save")} - - - { - leaveSpace(space); - }} - > - {_t("room_settings|general|leave_space")} - - + {SettingsStore.getValue(UIFeature.LeaveSpaceButton) && ( + + { + leaveSpace(space); + }} + > + {_t("room_settings|general|leave_space")} + + + )} ); diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 68bc6500586..f2ef2e93766 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1527,6 +1527,10 @@ export const SETTINGS: { [setting: string]: ISetting } = { supportedLevels: LEVELS_UI_FEATURE, default: true, }, + [UIFeature.LeaveSpaceButton]: { + supportedLevels: LEVELS_UI_FEATURE, + default: true, + }, // Electron-specific settings, they are stored by Electron and set/read over an IPC. // We store them over there are they are necessary to know before the renderer process launches. diff --git a/src/settings/UIFeature.ts b/src/settings/UIFeature.ts index 478927ca5db..850146e5219 100644 --- a/src/settings/UIFeature.ts +++ b/src/settings/UIFeature.ts @@ -106,6 +106,7 @@ export const enum UIFeature { ShowRecentsInSuggestions = "UIFeature.showRecentsInSuggestions", AllowDirectUserInvite = "UIFeature.allowDirectUserInvite", SearchInAllRooms = "UIFeature.searchInAllRooms", + LeaveSpaceButton = "UIFeature.leaveSpaceButton", } export enum UIComponent {