Skip to content

feat(issues): Add front end for resolve in upcoming release #72619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions static/app/components/actions/resolve.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ReleaseFixture} from 'sentry-fixture/release';

import {
Expand Down Expand Up @@ -228,4 +229,39 @@ describe('ResolveActions', function () {
);
expect(screen.queryByLabelText('More resolve options')).not.toBeInTheDocument();
});

it('does render next release option with subtitle', async function () {
const onUpdate = jest.fn();
MockApiClient.addMockResponse({
url: '/projects/org-slug/project-slug/releases/',
body: [ReleaseFixture()],
});
render(<ResolveActions hasRelease projectSlug="project-slug" onUpdate={onUpdate} />);

await userEvent.click(screen.getByLabelText('More resolve options'));
expect(await screen.findByText('The next release')).toBeInTheDocument();
expect(
await screen.findByText('The next release after the current one')
).toBeInTheDocument();
});

it('does render in upcoming release', async function () {
const organization = OrganizationFixture({
features: ['resolve-in-upcoming-release'],
});
const onUpdate = jest.fn();
MockApiClient.addMockResponse({
url: '/projects/org-slug/project-slug/releases/',
body: [ReleaseFixture()],
});
render(<ResolveActions hasRelease projectSlug="project-slug" onUpdate={onUpdate} />, {
organization,
});

await userEvent.click(screen.getByLabelText('More resolve options'));
expect(await screen.findByText('The upcoming release')).toBeInTheDocument();
expect(
await screen.findByText('The next release that is not yet released')
).toBeInTheDocument();
});
});
42 changes: 39 additions & 3 deletions static/app/components/actions/resolve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ function ResolveActions({
});
}

function handleUpcomingReleaseResolution() {
if (hasRelease) {
onUpdate({
status: GroupStatus.RESOLVED,
statusDetails: {
inUpcomingRelease: true,
},
substatus: null,
});
}

trackAnalytics('resolve_issue', {
organization,
release: 'upcoming',
});
}

function handleNextReleaseResolution() {
if (hasRelease) {
onUpdate({
Expand Down Expand Up @@ -188,12 +205,25 @@ function ResolveActions({
});
};

const hasUpcomingRelease = organization.features.includes(
'resolve-in-upcoming-release'
);

const isSemver = latestRelease ? isSemverRelease(latestRelease.version) : false;
const items: MenuItemProps[] = [
{
key: 'upcoming-release',
label: t('The upcoming release'),
details: actionTitle
? actionTitle
: t('The next release that is not yet released'),
onAction: () => onActionOrConfirm(handleUpcomingReleaseResolution),
hidden: !hasUpcomingRelease,
},
{
key: 'next-release',
label: t('The next release'),
details: actionTitle,
details: actionTitle ? actionTitle : t('The next release after the current one'),
onAction: () => onActionOrConfirm(handleNextReleaseResolution),
},
{
Expand Down Expand Up @@ -238,9 +268,15 @@ function ResolveActions({
)}
disabledKeys={
multipleProjectsSelected
? ['next-release', 'current-release', 'another-release', 'a-commit']
? [
'next-release',
'current-release',
'another-release',
'a-commit',
'upcoming-release',
]
: disabled || !hasRelease
? ['next-release', 'current-release', 'another-release']
? ['next-release', 'current-release', 'another-release', 'upcoming-release']
: []
}
menuTitle={shouldDisplayCta ? <SetupReleasesPrompt /> : t('Resolved In')}
Expand Down
21 changes: 21 additions & 0 deletions static/app/components/resolutionBox.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,25 @@ describe('ResolutionBox', function () {
'This issue has been marked as resolved by f7f395din'
);
});

it('handles inUpcomingRelease', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inUpcomingRelease: true,
actor: {
id: '111',
name: 'David Cramer',
username: 'dcramer',
ip_address: '127.0.0.1',
email: '[email protected]',
},
}}
projectId="1"
/>
);
expect(container).toHaveTextContent(
'David Cramer marked this issue as resolved in the upcoming release.'
);
});
});
9 changes: 9 additions & 0 deletions static/app/components/resolutionBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ function renderReason(
})
: t('This issue has been marked as resolved in the upcoming release.');
}

if (statusDetails.inUpcomingRelease) {
return actor
? tct('[actor] marked this issue as resolved in the upcoming release.', {
actor,
})
: t('This issue has been marked as resolved in the upcoming release.');
}

if (statusDetails.inRelease) {
const version = (
<Version
Expand Down
1 change: 1 addition & 0 deletions static/app/types/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ export interface ResolvedStatusDetails {
};
inNextRelease?: boolean;
inRelease?: string;
inUpcomingRelease?: boolean;
repository?: string;
}
interface ReprocessingStatusDetails {
Expand Down
Loading