Skip to content

Commit

Permalink
Merge branch 'verji-develop' of https://github.com/verji/matrix-react…
Browse files Browse the repository at this point in the history
…-sdk into verji-develop
  • Loading branch information
John Tore Simonsen committed Dec 13, 2024
2 parents 0924306 + 497370b commit 62d6dc7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
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

0 comments on commit 62d6dc7

Please sign in to comment.