Skip to content

Commit d723376

Browse files
alexsohn1126claude
andcommitted
feat(slack): Auto-open upgrade modal for a single outdated workspace
From the integrations directory, the 'Update Now' nudge previously always sent the user to the configurations tab. When an org has exactly one installed workspace there is nothing to disambiguate, so append showInstallModal=1 to the link and let useAutoOpenInstallModal open the upgrade modal directly. Orgs with multiple workspaces still land on the config tab to choose which workspace to update. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9566165 commit d723376

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

static/app/views/settings/organizationIntegrations/integrationRow.spec.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,50 @@ describe('IntegrationRow', () => {
109109
);
110110
});
111111
});
112+
113+
describe('Update Now alert', () => {
114+
it('auto-opens the install modal for a single outdated workspace', () => {
115+
render(
116+
<IntegrationRow
117+
organization={org}
118+
type="firstParty"
119+
slug="slack"
120+
displayName="Slack"
121+
status="Installed"
122+
publishStatus="published"
123+
configurations={1}
124+
categories={[]}
125+
alertText="Update to the latest version of our Slack app"
126+
resolveText="Update Now"
127+
/>
128+
);
129+
expect(screen.getByRole('button', {name: 'Update Now'})).toHaveAttribute(
130+
'href',
131+
`/settings/${org.slug}/integrations/slack/?tab=configurations&referrer=directory_resolve_now&showInstallModal=1`
132+
);
133+
});
134+
135+
it('sends users to the config page when multiple workspaces exist', () => {
136+
render(
137+
<IntegrationRow
138+
organization={org}
139+
type="firstParty"
140+
slug="slack"
141+
displayName="Slack"
142+
status="Installed"
143+
publishStatus="published"
144+
configurations={2}
145+
categories={[]}
146+
alertText="Update to the latest version of our Slack app"
147+
resolveText="Update Now"
148+
/>
149+
);
150+
const button = screen.getByRole('button', {name: 'Update Now'});
151+
expect(button).toHaveAttribute(
152+
'href',
153+
`/settings/${org.slug}/integrations/slack/?tab=configurations&referrer=directory_resolve_now`
154+
);
155+
expect(button.getAttribute('href')).not.toContain('showInstallModal');
156+
});
157+
});
112158
});

static/app/views/settings/organizationIntegrations/integrationRow.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ export function IntegrationRow(props: Props) {
7373
? `/settings/${organization.slug}/developer-settings/${slug}/`
7474
: `/settings/${organization.slug}/${urlMap[type]}/${slug}/`;
7575

76+
// When there's exactly one installed workspace there's nothing to
77+
// disambiguate, so auto-open the install/upgrade modal (via
78+
// `useAutoOpenInstallModal`) instead of making the user pick on the config
79+
// page. With multiple workspaces we still send them to the config tab to
80+
// choose which one to update.
81+
const resolveNowHref =
82+
`${baseUrl}?tab=configurations&referrer=directory_resolve_now` +
83+
(configurations === 1 ? '&showInstallModal=1' : '');
84+
7685
const renderDetails = () => {
7786
if (type === 'sentryApp') {
7887
return publishStatus !== 'published' && <PublishStatus status={publishStatus} />;
@@ -119,7 +128,7 @@ export function IntegrationRow(props: Props) {
119128
variant="warning"
120129
trailingItems={
121130
<LinkButton
122-
href={`${baseUrl}?tab=configurations&referrer=directory_resolve_now`}
131+
href={resolveNowHref}
123132
variant="primary"
124133
size="xs"
125134
onClick={() =>

0 commit comments

Comments
 (0)