Skip to content

Commit 459eba4

Browse files
authored
feat(issues): Add front end for resolve in upcoming release (#72619)
this pr makes the front end changes to support resolve in upcoming release. backend changes in #70990. the changes made include adding an option to the Resolve button on issue details (hidden behind a feature flag), adding a subtitle to the resolve dropdown to clarify behavior, and updating the resolution box to support this form of resolution. the group activities item shouldn't need any updates as it mirrors the behavior as "resolve in next release"
1 parent 30e5008 commit 459eba4

File tree

5 files changed

+106
-3
lines changed

5 files changed

+106
-3
lines changed

static/app/components/actions/resolve.spec.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {OrganizationFixture} from 'sentry-fixture/organization';
12
import {ReleaseFixture} from 'sentry-fixture/release';
23

34
import {
@@ -228,4 +229,39 @@ describe('ResolveActions', function () {
228229
);
229230
expect(screen.queryByLabelText('More resolve options')).not.toBeInTheDocument();
230231
});
232+
233+
it('does render next release option with subtitle', async function () {
234+
const onUpdate = jest.fn();
235+
MockApiClient.addMockResponse({
236+
url: '/projects/org-slug/project-slug/releases/',
237+
body: [ReleaseFixture()],
238+
});
239+
render(<ResolveActions hasRelease projectSlug="project-slug" onUpdate={onUpdate} />);
240+
241+
await userEvent.click(screen.getByLabelText('More resolve options'));
242+
expect(await screen.findByText('The next release')).toBeInTheDocument();
243+
expect(
244+
await screen.findByText('The next release after the current one')
245+
).toBeInTheDocument();
246+
});
247+
248+
it('does render in upcoming release', async function () {
249+
const organization = OrganizationFixture({
250+
features: ['resolve-in-upcoming-release'],
251+
});
252+
const onUpdate = jest.fn();
253+
MockApiClient.addMockResponse({
254+
url: '/projects/org-slug/project-slug/releases/',
255+
body: [ReleaseFixture()],
256+
});
257+
render(<ResolveActions hasRelease projectSlug="project-slug" onUpdate={onUpdate} />, {
258+
organization,
259+
});
260+
261+
await userEvent.click(screen.getByLabelText('More resolve options'));
262+
expect(await screen.findByText('The upcoming release')).toBeInTheDocument();
263+
expect(
264+
await screen.findByText('The next release that is not yet released')
265+
).toBeInTheDocument();
266+
});
231267
});

static/app/components/actions/resolve.tsx

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ function ResolveActions({
124124
});
125125
}
126126

127+
function handleUpcomingReleaseResolution() {
128+
if (hasRelease) {
129+
onUpdate({
130+
status: GroupStatus.RESOLVED,
131+
statusDetails: {
132+
inUpcomingRelease: true,
133+
},
134+
substatus: null,
135+
});
136+
}
137+
138+
trackAnalytics('resolve_issue', {
139+
organization,
140+
release: 'upcoming',
141+
});
142+
}
143+
127144
function handleNextReleaseResolution() {
128145
if (hasRelease) {
129146
onUpdate({
@@ -188,12 +205,25 @@ function ResolveActions({
188205
});
189206
};
190207

208+
const hasUpcomingRelease = organization.features.includes(
209+
'resolve-in-upcoming-release'
210+
);
211+
191212
const isSemver = latestRelease ? isSemverRelease(latestRelease.version) : false;
192213
const items: MenuItemProps[] = [
214+
{
215+
key: 'upcoming-release',
216+
label: t('The upcoming release'),
217+
details: actionTitle
218+
? actionTitle
219+
: t('The next release that is not yet released'),
220+
onAction: () => onActionOrConfirm(handleUpcomingReleaseResolution),
221+
hidden: !hasUpcomingRelease,
222+
},
193223
{
194224
key: 'next-release',
195225
label: t('The next release'),
196-
details: actionTitle,
226+
details: actionTitle ? actionTitle : t('The next release after the current one'),
197227
onAction: () => onActionOrConfirm(handleNextReleaseResolution),
198228
},
199229
{
@@ -238,9 +268,15 @@ function ResolveActions({
238268
)}
239269
disabledKeys={
240270
multipleProjectsSelected
241-
? ['next-release', 'current-release', 'another-release', 'a-commit']
271+
? [
272+
'next-release',
273+
'current-release',
274+
'another-release',
275+
'a-commit',
276+
'upcoming-release',
277+
]
242278
: disabled || !hasRelease
243-
? ['next-release', 'current-release', 'another-release']
279+
? ['next-release', 'current-release', 'another-release', 'upcoming-release']
244280
: []
245281
}
246282
menuTitle={shouldDisplayCta ? <SetupReleasesPrompt /> : t('Resolved In')}

static/app/components/resolutionBox.spec.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,25 @@ describe('ResolutionBox', function () {
112112
'This issue has been marked as resolved by f7f395din'
113113
);
114114
});
115+
116+
it('handles inUpcomingRelease', function () {
117+
const {container} = render(
118+
<ResolutionBox
119+
statusDetails={{
120+
inUpcomingRelease: true,
121+
actor: {
122+
id: '111',
123+
name: 'David Cramer',
124+
username: 'dcramer',
125+
ip_address: '127.0.0.1',
126+
127+
},
128+
}}
129+
projectId="1"
130+
/>
131+
);
132+
expect(container).toHaveTextContent(
133+
'David Cramer marked this issue as resolved in the upcoming release.'
134+
);
135+
});
115136
});

static/app/components/resolutionBox.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ function renderReason(
7474
})
7575
: t('This issue has been marked as resolved in the upcoming release.');
7676
}
77+
78+
if (statusDetails.inUpcomingRelease) {
79+
return actor
80+
? tct('[actor] marked this issue as resolved in the upcoming release.', {
81+
actor,
82+
})
83+
: t('This issue has been marked as resolved in the upcoming release.');
84+
}
85+
7786
if (statusDetails.inRelease) {
7887
const version = (
7988
<Version

static/app/types/group.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ export interface ResolvedStatusDetails {
714714
};
715715
inNextRelease?: boolean;
716716
inRelease?: string;
717+
inUpcomingRelease?: boolean;
717718
repository?: string;
718719
}
719720
interface ReprocessingStatusDetails {

0 commit comments

Comments
 (0)