mirror of https://github.com/vector-im/riot-web
Hide account deactivation for externally managed accounts (#11445)
* 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 <andy.balaam@matrix.org>pull/28217/head
parent
23196d49e1
commit
3684c77cfe
|
@ -527,7 +527,8 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
|
||||||
const supportsMultiLanguageSpellCheck = plaf?.supportsSpellCheckSettings();
|
const supportsMultiLanguageSpellCheck = plaf?.supportsSpellCheckSettings();
|
||||||
|
|
||||||
let accountManagementSection: JSX.Element | undefined;
|
let accountManagementSection: JSX.Element | undefined;
|
||||||
if (SettingsStore.getValue(UIFeature.Deactivate)) {
|
const isAccountManagedExternally = !!this.state.externalAccountManagementUrl;
|
||||||
|
if (SettingsStore.getValue(UIFeature.Deactivate) && !isAccountManagedExternally) {
|
||||||
accountManagementSection = this.renderManagementSection();
|
accountManagementSection = this.renderManagementSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,23 @@ describe("<GeneralUserSettingsTab />", () => {
|
||||||
expect(screen.queryByText("Deactivate account")).not.toBeInTheDocument();
|
expect(screen.queryByText("Deactivate account")).not.toBeInTheDocument();
|
||||||
expect(SettingsStore.getValue).toHaveBeenCalledWith(UIFeature.Deactivate);
|
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", () => {
|
it("should render section when account deactivation feature is enabled", () => {
|
||||||
jest.spyOn(SettingsStore, "getValue").mockImplementation(
|
jest.spyOn(SettingsStore, "getValue").mockImplementation(
|
||||||
(settingName) => settingName === UIFeature.Deactivate,
|
(settingName) => settingName === UIFeature.Deactivate,
|
||||||
|
|
|
@ -42,14 +42,14 @@ exports[`<GeneralUserSettingsTab /> 3pids should display 3pid email addresses an
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
id="mx_Field_57"
|
id="mx_Field_61"
|
||||||
label="Email Address"
|
label="Email Address"
|
||||||
placeholder="Email Address"
|
placeholder="Email Address"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
for="mx_Field_57"
|
for="mx_Field_61"
|
||||||
>
|
>
|
||||||
Email Address
|
Email Address
|
||||||
</label>
|
</label>
|
||||||
|
@ -150,14 +150,14 @@ exports[`<GeneralUserSettingsTab /> 3pids should display 3pid email addresses an
|
||||||
</span>
|
</span>
|
||||||
<input
|
<input
|
||||||
autocomplete="tel-national"
|
autocomplete="tel-national"
|
||||||
id="mx_Field_58"
|
id="mx_Field_62"
|
||||||
label="Phone Number"
|
label="Phone Number"
|
||||||
placeholder="Phone Number"
|
placeholder="Phone Number"
|
||||||
type="text"
|
type="text"
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
for="mx_Field_58"
|
for="mx_Field_62"
|
||||||
>
|
>
|
||||||
Phone Number
|
Phone Number
|
||||||
</label>
|
</label>
|
||||||
|
|
Loading…
Reference in New Issue