Skip to content

Commit

Permalink
reverted a bad commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Mohseni committed Jul 4, 2024
1 parent 4a16bf4 commit 6a1173b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/components/views/context_menus/SpaceContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import { useFeatureEnabled } from "../../../hooks/useSettings";
import { Action } from "../../../dispatcher/actions";
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
import { UIComponent, UIFeature } from "../../../settings/UIFeature";
import { UIComponent } from "../../../settings/UIFeature";
import PosthogTrackers from "../../../PosthogTrackers";
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";

Expand Down Expand Up @@ -259,7 +259,7 @@ const SpaceContextMenu: React.FC<IProps> = ({ space, hideHeader, onFinished, ...
/>
{devtoolsOption}
{settingsOption}
{SettingsStore.getValue(UIFeature.ShowLeaveSpaceInContextMenu) && leaveOption}
{leaveOption}
{newRoomSection}
</IconizedContextMenuOptionList>
</IconizedContextMenu>
Expand Down
4 changes: 0 additions & 4 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1243,10 +1243,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
},
[UIFeature.ShowLeaveSpaceInContextMenu]: {
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: 0 additions & 1 deletion src/settings/UIFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const enum UIFeature {
TimelineEnableRelativeDates = "UIFeature.timelineEnableRelativeDates",
BulkUnverifiedSessionsReminder = "UIFeature.BulkUnverifiedSessionsReminder",
ShowCreateSpaceButton = "UIFeature.showCreateSpaceButton",
ShowLeaveSpaceInContextMenu = "UIFeature.showLeaveSpaceInContextMenu",
}

export enum UIComponent {
Expand Down
25 changes: 1 addition & 24 deletions test/components/views/context_menus/SpaceContextMenu-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import {
} from "../../../../src/utils/space";
import { leaveSpace } from "../../../../src/utils/leave-behaviour";
import { shouldShowComponent } from "../../../../src/customisations/helpers/UIComponents";
import { UIComponent, UIFeature } from "../../../../src/settings/UIFeature";
import SettingsStore from "../../../../src/settings/SettingsStore";
import { UIComponent } from "../../../../src/settings/UIFeature";

jest.mock("../../../../src/customisations/helpers/UIComponents", () => ({
shouldShowComponent: jest.fn(),
Expand Down Expand Up @@ -224,26 +223,4 @@ describe("<SpaceContextMenu />", () => {
expect(onFinished).toHaveBeenCalled();
});
});

describe("UIFeature.ShowLeaveSpaceInContextMenu", () => {
it("ShowLeaveSpaceInContextMenu = true, renders 'leave space' option", () => {
mocked(shouldShowSpaceSettings).mockReturnValue(false);
jest.spyOn(SettingsStore, "getValue").mockImplementation((val) => {
return val === UIFeature.ShowLeaveSpaceInContextMenu ? true : "default";
});
renderComponent();

expect(screen.getByTestId("leave-option")).toBeInTheDocument();
});

it("ShowLeaveSpaceInContextMenu = false, does not render 'leave space' option", () => {
mocked(shouldShowSpaceSettings).mockReturnValue(false);
jest.spyOn(SettingsStore, "getValue").mockImplementation((val) => {
return val === UIFeature.ShowLeaveSpaceInContextMenu ? false : "default";
});
renderComponent();

expect(screen.queryByTestId("leave-option")).not.toBeInTheDocument();
});
});
});

0 comments on commit 6a1173b

Please sign in to comment.