Skip to content

feat(escalating): Add an unarchive button to issues stream #51185

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 1 commit into from
Jun 16, 2023
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
17 changes: 17 additions & 0 deletions static/app/views/issueList/actions/actionSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {useTheme} from '@emotion/react';
import ActionLink from 'sentry/components/actions/actionLink';
import ArchiveActions from 'sentry/components/actions/archive';
import IgnoreActions from 'sentry/components/actions/ignore';
import {Button} from 'sentry/components/button';
import {openConfirmModal} from 'sentry/components/confirm';
import {DropdownMenu, MenuItemProps} from 'sentry/components/dropdownMenu';
import {IconEllipsis} from 'sentry/icons';
Expand Down Expand Up @@ -195,6 +196,22 @@ function ActionSet({

return (
<Fragment>
{hasEscalatingIssuesUi && query.includes('is:archived') ? (
<Button
size="xs"
onClick={() => {
openConfirmModal({
bypass: !onShouldConfirm(ConfirmAction.UNRESOLVE),
onConfirm: () => onUpdate({status: ResolutionStatus.UNRESOLVED}),
message: confirm({action: ConfirmAction.UNRESOLVE, canBeUndone: true}),
confirmText: label('unarchive'),
});
}}
disabled={!anySelected}
>
{t('Unarchive')}
</Button>
) : null}
{hasEscalatingIssuesUi ? (
<ArchiveActions
onUpdate={onUpdate}
Expand Down
23 changes: 23 additions & 0 deletions static/app/views/issueList/actions/index.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,29 @@ describe('IssueListActions', function () {
);
});

it('can unarchive an issue when the query contains is:archived', async () => {
const org_escalating = {...organization, features: ['escalating-issues']};
const apiMock = MockApiClient.addMockResponse({
url: `/organizations/${org_escalating.slug}/issues/`,
method: 'PUT',
});
jest.spyOn(SelectedGroupStore, 'getSelectedIds').mockReturnValue(new Set(['1']));

render(<WrappedComponent {...defaultProps} query="is:archived" />, {
organization: org_escalating,
});

await userEvent.click(screen.getByRole('button', {name: 'Unarchive'}));

expect(apiMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
query: expect.objectContaining({id: ['1'], project: [1]}),
data: {status: 'unresolved'},
})
);
});

it('can resolve but not merge issues from different projects', function () {
jest
.spyOn(SelectedGroupStore, 'getSelectedIds')
Expand Down