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

Commit

Permalink
Hide account deactivation for externally managed accounts (#11445)
Browse files Browse the repository at this point in the history
* util for account url

* test cases

* disable multi session selection on device list

* remove sign out all from context menus when oidc-aware

* comment

* remove unused param

* typo

* dont show account deactivation for externally managed accounts

* Update snapshots - field ID changed

---------

Co-authored-by: Andy Balaam <[email protected]>
  • Loading branch information
Kerry and andybalaam authored Aug 22, 2023
1 parent 23196d4 commit 3684c77
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
const supportsMultiLanguageSpellCheck = plaf?.supportsSpellCheckSettings();

let accountManagementSection: JSX.Element | undefined;
if (SettingsStore.getValue(UIFeature.Deactivate)) {
const isAccountManagedExternally = !!this.state.externalAccountManagementUrl;
if (SettingsStore.getValue(UIFeature.Deactivate) && !isAccountManagedExternally) {
accountManagementSection = this.renderManagementSection();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ describe("<GeneralUserSettingsTab />", () => {
expect(screen.queryByText("Deactivate account")).not.toBeInTheDocument();
expect(SettingsStore.getValue).toHaveBeenCalledWith(UIFeature.Deactivate);
});
it("should not render section when account is managed externally", async () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(settingName) => settingName === UIFeature.Deactivate,
);
// account is managed externally when we have delegated auth configured
mockClient.getClientWellKnown.mockReturnValue({
[M_AUTHENTICATION.name]: {
issuer: "https://issuer.org",
account: "https://issuer.org/account",
},
});
render(getComponent());

await flushPromises();

expect(screen.queryByText("Deactivate account")).not.toBeInTheDocument();
});
it("should render section when account deactivation feature is enabled", () => {
jest.spyOn(SettingsStore, "getValue").mockImplementation(
(settingName) => settingName === UIFeature.Deactivate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ exports[`<GeneralUserSettingsTab /> 3pids should display 3pid email addresses an
>
<input
autocomplete="email"
id="mx_Field_57"
id="mx_Field_61"
label="Email Address"
placeholder="Email Address"
type="text"
value=""
/>
<label
for="mx_Field_57"
for="mx_Field_61"
>
Email Address
</label>
Expand Down Expand Up @@ -150,14 +150,14 @@ exports[`<GeneralUserSettingsTab /> 3pids should display 3pid email addresses an
</span>
<input
autocomplete="tel-national"
id="mx_Field_58"
id="mx_Field_62"
label="Phone Number"
placeholder="Phone Number"
type="text"
value=""
/>
<label
for="mx_Field_58"
for="mx_Field_62"
>
Phone Number
</label>
Expand Down

0 comments on commit 3684c77

Please sign in to comment.