Commit 6d781001 authored by Stan Hu's avatar Stan Hu

Hide confirmation modal after closing a blocked issue

When a user closes an issue that is blocked by another, the "Are you
sure you want to close this blocked issue?" modal displays but does not
go away after clicking "Yes, close issue". This causes confusion in two
ways:

1. It's not clear whether the button was clicked.
2. When the issue is closed, the modal still remains, making it look
like the issue may not have been closed.

We now hide the modal immediately after the "Yes" button is clicked.
Note this only happened if the bottom `Close issue` were clicked; the
top one worked fine.
parent ffea1ee9
......@@ -397,7 +397,7 @@ export default {
:secondary-button-text="__('Cancel')"
variant="warning"
:dismissible="false"
@primaryAction="forceCloseIssue"
@primaryAction="toggleBlockedIssueWarning(false) && forceCloseIssue()"
@secondaryAction="toggleBlockedIssueWarning(false) && enableButton()"
>
<p>
......
---
title: Hide confirmation modal after closing a blocked issue
merge_request: 42068
author:
type: fixed
......@@ -94,6 +94,31 @@ RSpec.describe 'Related issues', :js do
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
end
it 'hides the modal when issue is closed' do
# Workaround for modal not showing when issue is first added
visit project_issue_path(project, issue_a)
wait_for_requests
within('.new-note') do
button = find(:button, 'Close issue')
scroll_to(button)
button.click
end
click_button 'Yes, close issue'
wait_for_requests
find(:button, 'Yes, close issue', visible: false)
status_box = first('.status-box', visible: :all)
scroll_to(status_box)
within(status_box) do
expect(page).to have_content 'Closed'
end
end
end
context 'when adding "relates_to", "blocks", and "is_blocked_by" issues' do
......
......@@ -119,6 +119,13 @@ describe('issue_comment_form component', () => {
const primaryButton = warning.find('.gl-alert-actions .gl-button');
expect(primaryButton.text()).toEqual('Yes, close issue');
primaryButton.trigger('click');
wrapper.vm.$nextTick(() => {
expect(warning.exists()).toBe(false);
done();
});
setTimeout(() => {
expect(wrapper.vm.closeIssue).toHaveBeenCalled();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment