Skip to content

Commit 1315d8b

Browse files
committed
chore: put back old prop
1 parent b92f37b commit 1315d8b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/ui/src/components/OAuthConsent/OAuthConsent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function _OAuthConsent() {
7272
const redirectUrl = ctx.redirectUrl ?? getRedirectUriFromSearch();
7373

7474
const hasOrgReadScope = scopes.some(s => s.scope === USER_ORG_READ_SCOPE);
75-
const orgSelectionEnabled = !!(hasOrgReadScope && organizationSettings.enabled);
75+
const orgSelectionEnabled = !!((hasOrgReadScope || ctx.enableOrgSelection) && organizationSettings.enabled);
7676
const orgOptions = orgSelectionEnabled
7777
? (user?.organizationMemberships ?? []).map(m => ({
7878
value: m.organization.id,

packages/ui/src/components/OAuthConsent/__tests__/OAuthConsent.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,25 @@ describe('OAuthConsent', () => {
390390
});
391391
});
392392

393+
it('renders the org selector when __internal_enableOrgSelection is true (fallback for existing apps)', async () => {
394+
const { wrapper, fixtures, props } = await createFixtures(f => {
395+
f.withUser({
396+
email_addresses: ['jane@example.com'],
397+
organization_memberships: [{ id: 'org_1', name: 'Acme Corp' }],
398+
});
399+
f.withOrganizations();
400+
});
401+
402+
props.setProps({ componentName: 'OAuthConsent', __internal_enableOrgSelection: true } as any);
403+
mockOAuthApplication(fixtures.clerk, { getConsentInfo: vi.fn().mockResolvedValue(fakeConsentInfo) });
404+
405+
const { getByText } = render(<OAuthConsent />, { wrapper });
406+
407+
await waitFor(() => {
408+
expect(getByText('Acme Corp')).toBeVisible();
409+
});
410+
});
411+
393412
it('does not display user:org:read in the scopes list', async () => {
394413
const { wrapper, fixtures, props } = await createFixtures(f => {
395414
f.withUser({

0 commit comments

Comments
 (0)