Skip to content

Commit

Permalink
Eik/reactivate securitytab (#70)
Browse files Browse the repository at this point in the history
* 1982 translations

* 1967 Security tab is missing

* 1967 Security tab is missing

* 1967 Security tab is missing

* 1967 Security tab is missing
  • Loading branch information
eiksta authored Aug 12, 2024
1 parent fe5b96a commit 7b60af3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import SettingsTab from "../SettingsTab";
import { SettingsSection } from "../../shared/SettingsSection";
import SettingsSubsection, { SettingsSubsectionText } from "../../shared/SettingsSubsection";
import SdkConfig from "../../../../../SdkConfig";
import { UIFeature } from "../../../../../settings/UIFeature";

type InteractionName = "WebSettingsSidebarTabSpacesCheckbox" | "WebQuickSettingsPinToSidebarCheckbox";

Expand Down Expand Up @@ -79,8 +78,6 @@ const SidebarUserSettingsTab: React.FC = () => {
PosthogTrackers.trackInteraction("WebSettingsSidebarTabSpacesCheckbox", event, 1);
};

if (!SettingsStore.getValue(UIFeature.SpacesEnabled)) return <></>;

return (
<SettingsTab>
<SettingsSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { MetaSpace } from "../../../../../../src/stores/spaces";
import { SettingLevel } from "../../../../../../src/settings/SettingLevel";
import { flushPromises } from "../../../../../test-utils";
import SdkConfig from "../../../../../../src/SdkConfig";
import { UIFeature } from "../../../../../../src/settings/UIFeature";

describe("<SidebarUserSettingsTab />", () => {
beforeEach(() => {
Expand Down Expand Up @@ -64,7 +63,7 @@ describe("<SidebarUserSettingsTab />", () => {
[MetaSpace.Orphans]: true,
};
}
if (settingName == UIFeature.SpacesEnabled) return true;

return false;
});
render(<SidebarUserSettingsTab />);
Expand Down Expand Up @@ -92,47 +91,11 @@ describe("<SidebarUserSettingsTab />", () => {
[MetaSpace.Orphans]: true,
};
}
if (settingName == UIFeature.SpacesEnabled) return true;
return false;
});
render(<SidebarUserSettingsTab />);

expect(screen.getByTestId("mx_SidebarUserSettingsTab_homeAllRoomsCheckbox")).toBeDisabled();
});

//eik
it("render sidebar when feature is on", async () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
if (settingName === "Spaces.enabledMetaSpaces") {
return {
[MetaSpace.Home]: true,
[MetaSpace.Favourites]: true,
[MetaSpace.People]: true,
[MetaSpace.Orphans]: true,
};
}
if (settingName == UIFeature.SpacesEnabled) return true;
return false;
});
render(<SidebarUserSettingsTab />);

expect(screen.getByTestId("mx_SidebarUserSettingsTab_homeAllRoomsCheckbox")).toBeInTheDocument();
});
it("does not render sidebar when feature is off", async () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName) => {
if (settingName === "Spaces.enabledMetaSpaces") {
return {
[MetaSpace.Home]: true,
[MetaSpace.Favourites]: true,
[MetaSpace.People]: true,
[MetaSpace.Orphans]: true,
};
}
if (settingName == UIFeature.SpacesEnabled) return false;
return false;
});
render(<SidebarUserSettingsTab />);

expect(screen.queryByText("In conferences you can invite people outside of matrix.")).toBeNull();
expect(screen.getByTestId("mx_SidebarUserSettingsTab_homeAllRoomsCheckbox")).toBeDisabled();
});
});

0 comments on commit 7b60af3

Please sign in to comment.