Skip to content

Commit 23e6996

Browse files
ref(ui): Remove usage of withOrganization from organizationAuthList (#86554)
1 parent 0cd811b commit 23e6996

File tree

2 files changed

+23
-46
lines changed

2 files changed

+23
-46
lines changed

static/app/views/settings/organizationAuth/organizationAuthList.spec.tsx

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,15 @@ import {OrganizationAuthList} from 'sentry/views/settings/organizationAuth/organ
77

88
describe('OrganizationAuthList', function () {
99
it('renders with no providers', function () {
10-
render(
11-
<OrganizationAuthList organization={OrganizationFixture()} providerList={[]} />
12-
);
10+
render(<OrganizationAuthList providerList={[]} />);
1311

1412
expect(
1513
screen.getByText('No authentication providers are available.')
1614
).toBeInTheDocument();
1715
});
1816

1917
it('renders', function () {
20-
render(
21-
<OrganizationAuthList
22-
organization={OrganizationFixture()}
23-
providerList={AuthProvidersFixture()}
24-
/>
25-
);
18+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />);
2619

2720
expect(screen.getAllByLabelText('Configure')).toHaveLength(2);
2821
expect(screen.getByText('Dummy')).toBeInTheDocument();
@@ -34,10 +27,10 @@ describe('OrganizationAuthList', function () {
3427

3528
render(
3629
<OrganizationAuthList
37-
organization={organization}
3830
providerList={AuthProvidersFixture()}
3931
activeProvider={AuthProvidersFixture()[0]}
40-
/>
32+
/>,
33+
{organization}
4134
);
4235

4336
expect(screen.getByText('Active')).toBeInTheDocument();
@@ -51,12 +44,9 @@ describe('OrganizationAuthList', function () {
5144
it('renders', function () {
5245
const organization = OrganizationFixture({...require2fa, ...withSSO});
5346

54-
render(
55-
<OrganizationAuthList
56-
organization={organization}
57-
providerList={AuthProvidersFixture()}
58-
/>
59-
);
47+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
48+
organization,
49+
});
6050

6151
expect(
6252
screen.getByText('Require 2FA will be disabled if you enable SSO.')
@@ -66,12 +56,9 @@ describe('OrganizationAuthList', function () {
6656
it('renders with saml available', function () {
6757
const organization = OrganizationFixture({...require2fa, ...withSAML});
6858

69-
render(
70-
<OrganizationAuthList
71-
organization={organization}
72-
providerList={AuthProvidersFixture()}
73-
/>
74-
);
59+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
60+
organization,
61+
});
7562

7663
expect(
7764
screen.getByText('Require 2FA will be disabled if you enable SSO.')
@@ -81,12 +68,9 @@ describe('OrganizationAuthList', function () {
8168
it('does not render without sso available', function () {
8269
const organization = OrganizationFixture({...require2fa});
8370

84-
render(
85-
<OrganizationAuthList
86-
organization={organization}
87-
providerList={AuthProvidersFixture()}
88-
/>
89-
);
71+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
72+
organization,
73+
});
9074

9175
expect(
9276
screen.queryByText('Require 2FA will be disabled if you enable SSO.')
@@ -96,12 +80,9 @@ describe('OrganizationAuthList', function () {
9680
it('does not render with sso and require 2fa disabled', function () {
9781
const organization = OrganizationFixture({...withSSO});
9882

99-
render(
100-
<OrganizationAuthList
101-
organization={organization}
102-
providerList={AuthProvidersFixture()}
103-
/>
104-
);
83+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
84+
organization,
85+
});
10586

10687
expect(
10788
screen.queryByText('Require 2FA will be disabled if you enable SSO.')
@@ -111,12 +92,9 @@ describe('OrganizationAuthList', function () {
11192
it('does not render with saml and require 2fa disabled', function () {
11293
const organization = OrganizationFixture({...withSAML});
11394

114-
render(
115-
<OrganizationAuthList
116-
organization={organization}
117-
providerList={AuthProvidersFixture()}
118-
/>
119-
);
95+
render(<OrganizationAuthList providerList={AuthProvidersFixture()} />, {
96+
organization,
97+
});
12098

12199
expect(
122100
screen.queryByText('Require 2FA will be disabled if you enable SSO.')

static/app/views/settings/organizationAuth/organizationAuthList.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import PanelBody from 'sentry/components/panels/panelBody';
66
import PanelHeader from 'sentry/components/panels/panelHeader';
77
import {t, tct} from 'sentry/locale';
88
import type {AuthProvider} from 'sentry/types/auth';
9-
import type {Organization} from 'sentry/types/organization';
109
import {descopeFeatureName} from 'sentry/utils';
1110
import getCsrfToken from 'sentry/utils/getCsrfToken';
12-
import withOrganization from 'sentry/utils/withOrganization';
11+
import useOrganization from 'sentry/utils/useOrganization';
1312
import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
1413
import {OrganizationPermissionAlert} from 'sentry/views/settings/organization/organizationPermissionAlert';
1514

@@ -28,12 +27,12 @@ const PROVIDER_POPULARITY: Record<string, number> = {
2827
};
2928

3029
type Props = {
31-
organization: Organization;
3230
providerList: AuthProvider[];
3331
activeProvider?: AuthProvider;
3432
};
3533

36-
function OrganizationAuthList({organization, providerList, activeProvider}: Props) {
34+
function OrganizationAuthList({providerList, activeProvider}: Props) {
35+
const organization = useOrganization();
3736
const features = organization.features;
3837

3938
// Sort provider list twice: first, by popularity,
@@ -118,7 +117,7 @@ function OrganizationAuthList({organization, providerList, activeProvider}: Prop
118117
);
119118
}
120119

121-
export default withOrganization(OrganizationAuthList);
120+
export default OrganizationAuthList;
122121

123122
// For tests
124123
export {OrganizationAuthList};

0 commit comments

Comments
 (0)