From 3684c77cfe221702f6ba08cb904bba63160ec25c Mon Sep 17 00:00:00 2001 From: Kerry Date: Tue, 22 Aug 2023 23:51:16 +1200 Subject: [PATCH] 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 --- .../tabs/user/GeneralUserSettingsTab.tsx | 3 ++- .../tabs/user/GeneralUserSettingsTab-test.tsx | 17 +++++++++++++++++ .../GeneralUserSettingsTab-test.tsx.snap | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx index f17c73e5e1..418657dd86 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx @@ -527,7 +527,8 @@ export default class GeneralUserSettingsTab extends React.Component", () => { 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, diff --git a/test/components/views/settings/tabs/user/__snapshots__/GeneralUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/GeneralUserSettingsTab-test.tsx.snap index e2f20a35a7..a2e13ed843 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/GeneralUserSettingsTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/GeneralUserSettingsTab-test.tsx.snap @@ -42,14 +42,14 @@ exports[` 3pids should display 3pid email addresses an > @@ -150,14 +150,14 @@ exports[` 3pids should display 3pid email addresses an