Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5bf69d7

Browse files
committed
Remove labs setting for rust crypto
1 parent a7bf01f commit 5bf69d7

File tree

4 files changed

+1
-178
lines changed

4 files changed

+1
-178
lines changed

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,11 +1465,6 @@
14651465
"render_reaction_images_description": "Sometimes referred to as \"custom emojis\".",
14661466
"report_to_moderators": "Report to moderators",
14671467
"report_to_moderators_description": "In rooms that support moderation, the “Report” button will let you report abuse to room moderators.",
1468-
"rust_crypto": "Rust cryptography implementation",
1469-
"rust_crypto_in_config": "Rust cryptography cannot be disabled on this deployment of %(brand)s",
1470-
"rust_crypto_in_config_description": "Switching to the Rust cryptography requires a migration process that may take several minutes. It cannot be disabled; use with caution!",
1471-
"rust_crypto_optin_warning": "Switching to the Rust cryptography requires a migration process that may take several minutes. To disable you will need to log out and back in; use with caution!",
1472-
"rust_crypto_requires_logout": "Once enabled, Rust cryptography can only be disabled by logging out and in again",
14731468
"sliding_sync": "Sliding Sync mode",
14741469
"sliding_sync_description": "Under active development, cannot be disabled.",
14751470
"sliding_sync_disabled_notice": "Log out and back in to disable",

src/settings/Settings.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ import { MetaSpace } from "../stores/spaces";
4242
import SdkConfig from "../SdkConfig";
4343
import SlidingSyncController from "./controllers/SlidingSyncController";
4444
import { FontWatcher } from "./watchers/FontWatcher";
45-
import RustCryptoSdkController from "./controllers/RustCryptoSdkController";
4645
import ServerSupportUnstableFeatureController from "./controllers/ServerSupportUnstableFeatureController";
4746
import { WatchManager } from "./WatchManager";
4847
import { CustomTheme } from "../theme";
49-
import SettingsStore from "./SettingsStore";
5048
import AnalyticsController from "./controllers/AnalyticsController";
5149

5250
export const defaultWatchManager = new WatchManager();
@@ -479,24 +477,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
479477
description: _td("labs|oidc_native_flow_description"),
480478
default: false,
481479
},
482-
[Features.RustCrypto]: {
483-
// use the rust matrix-sdk-crypto-wasm for crypto.
484-
isFeature: true,
485-
labsGroup: LabGroup.Developer,
486-
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
487-
displayName: _td("labs|rust_crypto"),
488-
description: () => {
489-
if (SettingsStore.getValueAt(SettingLevel.CONFIG, Features.RustCrypto)) {
490-
// It's enabled in the config, so you can't get rid of it even by logging out.
491-
return _t("labs|rust_crypto_in_config_description");
492-
} else {
493-
return _t("labs|rust_crypto_optin_warning");
494-
}
495-
},
496-
shouldWarn: true,
497-
default: true,
498-
controller: new RustCryptoSdkController(),
499-
},
500480
/**
501481
* @deprecated in favor of {@link fontSizeDelta}
502482
*/

src/settings/controllers/RustCryptoSdkController.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ limitations under the License.
1515
*/
1616

1717
import React from "react";
18-
import { render, screen, waitFor } from "@testing-library/react";
19-
import userEvent from "@testing-library/user-event";
18+
import { render, screen } from "@testing-library/react";
2019

2120
import LabsUserSettingsTab from "../../../../../../src/components/views/settings/tabs/user/LabsUserSettingsTab";
2221
import SettingsStore from "../../../../../../src/settings/SettingsStore";
2322
import SdkConfig from "../../../../../../src/SdkConfig";
24-
import { SettingLevel } from "../../../../../../src/settings/SettingLevel";
2523

2624
describe("<LabsUserSettingsTab />", () => {
2725
const defaultProps = {
@@ -63,105 +61,4 @@ describe("<LabsUserSettingsTab />", () => {
6361
const labsSections = container.getElementsByClassName("mx_SettingsSubsection");
6462
expect(labsSections).toHaveLength(10);
6563
});
66-
67-
describe("Rust crypto setting", () => {
68-
const SETTING_NAME = "Rust cryptography implementation";
69-
70-
beforeEach(() => {
71-
SdkConfig.add({ show_labs_settings: true });
72-
});
73-
74-
describe("Not enabled in config", () => {
75-
// these tests only works if the feature is not enabled in the config by default?
76-
const copyOfGetValueAt = SettingsStore.getValueAt;
77-
78-
beforeEach(() => {
79-
SettingsStore.getValueAt = (
80-
level: SettingLevel,
81-
name: string,
82-
roomId?: string,
83-
isExplicit?: boolean,
84-
) => {
85-
if (level == SettingLevel.CONFIG && name === "feature_rust_crypto") return false;
86-
return copyOfGetValueAt(level, name, roomId, isExplicit);
87-
};
88-
});
89-
90-
afterEach(() => {
91-
SettingsStore.getValueAt = copyOfGetValueAt;
92-
});
93-
94-
it("can be turned on if not already", async () => {
95-
// By the time the settings panel is shown, `MatrixClientPeg.initClientCrypto` has saved the current
96-
// value to the settings store.
97-
await SettingsStore.setValue("feature_rust_crypto", null, SettingLevel.DEVICE, false);
98-
99-
const rendered = render(getComponent());
100-
const toggle = rendered.getByRole("switch", { name: SETTING_NAME });
101-
expect(toggle.getAttribute("aria-disabled")).toEqual("false");
102-
expect(toggle.getAttribute("aria-checked")).toEqual("false");
103-
104-
const description = toggle.closest(".mx_SettingsFlag")?.querySelector(".mx_SettingsFlag_microcopy");
105-
expect(description).toHaveTextContent(/To disable you will need to log out and back in/);
106-
});
107-
108-
it("cannot be turned off once enabled", async () => {
109-
await SettingsStore.setValue("feature_rust_crypto", null, SettingLevel.DEVICE, true);
110-
111-
const rendered = render(getComponent());
112-
const toggle = rendered.getByRole("switch", { name: SETTING_NAME });
113-
expect(toggle.getAttribute("aria-disabled")).toEqual("true");
114-
expect(toggle.getAttribute("aria-checked")).toEqual("true");
115-
116-
// Hover over the toggle to make it show the tooltip
117-
await userEvent.hover(toggle);
118-
119-
await waitFor(() => {
120-
const tooltip = screen.getByRole("tooltip");
121-
expect(tooltip).toHaveTextContent(
122-
"Once enabled, Rust cryptography can only be disabled by logging out and in again",
123-
);
124-
});
125-
});
126-
});
127-
128-
describe("Enabled in config", () => {
129-
beforeEach(() => {
130-
SdkConfig.add({ features: { feature_rust_crypto: true } });
131-
});
132-
133-
it("can be turned on if not already", async () => {
134-
// By the time the settings panel is shown, `MatrixClientPeg.initClientCrypto` has saved the current
135-
// value to the settings store.
136-
await SettingsStore.setValue("feature_rust_crypto", null, SettingLevel.DEVICE, false);
137-
138-
const rendered = render(getComponent());
139-
const toggle = rendered.getByRole("switch", { name: SETTING_NAME });
140-
expect(toggle.getAttribute("aria-disabled")).toEqual("false");
141-
expect(toggle.getAttribute("aria-checked")).toEqual("false");
142-
143-
const description = toggle.closest(".mx_SettingsFlag")?.querySelector(".mx_SettingsFlag_microcopy");
144-
expect(description).toHaveTextContent(/It cannot be disabled/);
145-
});
146-
147-
it("cannot be turned off once enabled", async () => {
148-
await SettingsStore.setValue("feature_rust_crypto", null, SettingLevel.DEVICE, true);
149-
150-
const rendered = render(getComponent());
151-
const toggle = rendered.getByRole("switch", { name: SETTING_NAME });
152-
expect(toggle.getAttribute("aria-disabled")).toEqual("true");
153-
expect(toggle.getAttribute("aria-checked")).toEqual("true");
154-
155-
// Hover over the toggle to make it show the tooltip
156-
await userEvent.hover(toggle);
157-
158-
await waitFor(() => {
159-
const tooltip = rendered.getByRole("tooltip");
160-
expect(tooltip).toHaveTextContent(
161-
"Rust cryptography cannot be disabled on this deployment of BrandedClient",
162-
);
163-
});
164-
});
165-
});
166-
});
16764
});

0 commit comments

Comments
 (0)