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

Commit

Permalink
Move session manager out of beta (#10968)
Browse files Browse the repository at this point in the history
* remove old device manager

* undo type fix for cypress crypto

* update test case
  • Loading branch information
Kerry authored May 26, 2023
1 parent e326526 commit 530197b
Show file tree
Hide file tree
Showing 21 changed files with 450 additions and 1,673 deletions.
10 changes: 5 additions & 5 deletions cypress/e2e/register/register.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ describe("Registration", () => {

// check that the device considers itself verified
cy.findByRole("button", { name: "User menu" }).click();
cy.findByRole("menuitem", { name: "Security & Privacy" }).click();
cy.get(".mx_DevicesPanel_myDevice .mx_DevicesPanel_deviceTrust .mx_E2EIcon").should(
"have.class",
"mx_E2EIcon_verified",
);
cy.findByRole("menuitem", { name: "All settings" }).click();
cy.findByRole("tab", { name: "Sessions" }).click();
cy.findByTestId("current-session-section").within(() => {
cy.findByTestId("device-metadata-isVerified").should("have.text", "Verified");
});

// check that cross-signing keys have been uploaded.
checkDeviceIsCrossSigned();
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/settings/device-management.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ describe("Device manager", () => {
let user: UserCredentials | undefined;

beforeEach(() => {
cy.enableLabsFeature("feature_new_device_manager");
cy.startHomeserver("default").then((data) => {
homeserver = data;

Expand Down
1 change: 0 additions & 1 deletion res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
@import "./views/settings/_AvatarSetting.pcss";
@import "./views/settings/_CrossSigningPanel.pcss";
@import "./views/settings/_CryptographyPanel.pcss";
@import "./views/settings/_DevicesPanel.pcss";
@import "./views/settings/_FontScalingPanel.pcss";
@import "./views/settings/_ImageSizePanel.pcss";
@import "./views/settings/_IntegrationManager.pcss";
Expand Down
102 changes: 0 additions & 102 deletions res/css/views/settings/_DevicesPanel.pcss

This file was deleted.

7 changes: 3 additions & 4 deletions src/actions/handlers/viewUserDeviceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import { Action } from "../../dispatcher/actions";
import defaultDispatcher from "../../dispatcher/dispatcher";

/**
* Redirect to the correct device manager section
* Based on the labs setting
* Open user device manager settings
*/
export const viewUserDeviceSettings = (isNewDeviceManagerEnabled: boolean): void => {
export const viewUserDeviceSettings = (): void => {
defaultDispatcher.dispatch({
action: Action.ViewUserSettings,
initialTabId: isNewDeviceManagerEnabled ? UserTab.SessionManager : UserTab.Security,
initialTabId: UserTab.SessionManager,
});
};
2 changes: 1 addition & 1 deletion src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
break;
}
case Action.ViewUserDeviceSettings: {
viewUserDeviceSettings(SettingsStore.getValue("feature_new_device_manager"));
viewUserDeviceSettings();
break;
}
case Action.ViewUserSettings: {
Expand Down
34 changes: 11 additions & 23 deletions src/components/views/dialogs/UserSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ interface IProps {

interface IState {
mjolnirEnabled: boolean;
newSessionManagerEnabled: boolean;
}

export default class UserSettingsDialog extends React.Component<IProps, IState> {
Expand All @@ -56,15 +55,11 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>

this.state = {
mjolnirEnabled: SettingsStore.getValue("feature_mjolnir"),
newSessionManagerEnabled: SettingsStore.getValue("feature_new_device_manager"),
};
}

public componentDidMount(): void {
this.settingsWatchers = [
SettingsStore.watchSetting("feature_mjolnir", null, this.mjolnirChanged),
SettingsStore.watchSetting("feature_new_device_manager", null, this.sessionManagerChanged),
];
this.settingsWatchers = [SettingsStore.watchSetting("feature_mjolnir", null, this.mjolnirChanged)];
}

public componentWillUnmount(): void {
Expand All @@ -76,11 +71,6 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
this.setState({ mjolnirEnabled: newValue });
};

private sessionManagerChanged: CallbackFn = (settingName, roomId, atLevel, newValue) => {
// We can cheat because we know what levels a feature is tracked at, and how it is tracked
this.setState({ newSessionManagerEnabled: newValue });
};

private getTabs(): NonEmptyArray<Tab<UserTab>> {
const tabs: Tab<UserTab>[] = [];

Expand Down Expand Up @@ -160,18 +150,16 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
"UserSettingsSecurityPrivacy",
),
);
if (this.state.newSessionManagerEnabled) {
tabs.push(
new Tab(
UserTab.SessionManager,
_td("Sessions"),
"mx_UserSettingsDialog_sessionsIcon",
<SessionManagerTab />,
// don't track with posthog while under construction
undefined,
),
);
}
tabs.push(
new Tab(
UserTab.SessionManager,
_td("Sessions"),
"mx_UserSettingsDialog_sessionsIcon",
<SessionManagerTab />,
// don't track with posthog while under construction
undefined,
),
);
// Show the Labs tab if enabled or if there are any active betas
if (
SdkConfig.get("show_labs_settings") ||
Expand Down
Loading

0 comments on commit 530197b

Please sign in to comment.