Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature flag for "Leave Space" #101

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/components/views/spaces/SpaceSettingsGeneralTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -125,17 +127,18 @@ const SpaceSettingsGeneralTab: React.FC<IProps> = ({ matrixClient: cli, space })
{busy ? _t("common|saving") : _t("room_settings|general|save")}
</AccessibleButton>
</div>

<SettingsSubsection heading={_t("room_settings|general|leave_space")}>
<AccessibleButton
kind="danger"
onClick={() => {
leaveSpace(space);
}}
>
{_t("room_settings|general|leave_space")}
</AccessibleButton>
</SettingsSubsection>
{SettingsStore.getValue(UIFeature.LeaveSpaceButton) && (
<SettingsSubsection heading={_t("room_settings|general|leave_space")}>
<AccessibleButton
kind="danger"
onClick={() => {
leaveSpace(space);
}}
>
{_t("room_settings|general|leave_space")}
</AccessibleButton>
</SettingsSubsection>
)}
</SettingsSection>
</SettingsTab>
);
Expand Down
4 changes: 4 additions & 0 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/settings/UIFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const enum UIFeature {
ShowRecentsInSuggestions = "UIFeature.showRecentsInSuggestions",
AllowDirectUserInvite = "UIFeature.allowDirectUserInvite",
SearchInAllRooms = "UIFeature.searchInAllRooms",
LeaveSpaceButton = "UIFeature.leaveSpaceButton",
}

export enum UIComponent {
Expand Down
Loading