Commit 8a16309b authored by Brett Walker's avatar Brett Walker

Allow close status to be shown if issue is locked

This was regressed in 11.4
parent e9f09636
......@@ -64,6 +64,15 @@ module IssuesHelper
end
end
def issue_status_visibility(issue, status_box:)
case status_box
when :open
'hidden' if issue.closed?
when :closed
'hidden' unless issue.closed?
end
end
def issue_button_visibility(issue, closed)
return 'hidden' if issue_button_hidden?(issue, closed)
end
......
......@@ -12,11 +12,11 @@
.detail-page-header
.detail-page-header-body
.issuable-status-box.status-box.status-box-issue-closed{ class: issue_button_visibility(@issue, false) }
.issuable-status-box.status-box.status-box-issue-closed{ class: issue_status_visibility(@issue, status_box: :closed) }
= sprite_icon('mobile-issue-close', size: 16, css_class: 'd-block d-sm-none')
.d-none.d-sm-block
= issue_closed_text(@issue, current_user)
.issuable-status-box.status-box.status-box-open{ class: issue_button_visibility(@issue, true) }
.issuable-status-box.status-box.status-box-open{ class: issue_status_visibility(@issue, status_box: :open) }
= sprite_icon('issue-open-m', size: 16, css_class: 'd-block d-sm-none')
%span.d-none.d-sm-block Open
......
---
title: Allow close status to be shown on locked issues
merge_request: 16685
author:
type: fixed
......@@ -40,6 +40,13 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)')
end
it 'shows "Closed (moved)" if an issue has been moved and discussion is locked' do
allow(issue).to receive(:discussion_locked).and_return(true)
render
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)')
end
it 'links "moved" to the new issue the original issue was moved to' do
render
......@@ -95,12 +102,19 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed')
end
it 'shows "Closed" if discussion is locked' do
allow(issue).to receive(:discussion_locked).and_return(true)
render
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed')
end
end
context 'when the issue is open' do
before do
allow(issue).to receive(:closed?).and_return(false)
allow(issue).to receive(:disscussion_locked).and_return(false)
allow(issue).to receive(:discussion_locked).and_return(false)
end
it 'shows "Open" if an issue has been moved' do
......@@ -108,5 +122,12 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open')
end
it 'shows "Open" if discussion is locked' do
allow(issue).to receive(:discussion_locked).and_return(true)
render
expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open')
end
end
end
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