Commit dc4df41c authored by Fatih Acet's avatar Fatih Acet

Merge branch 'bw-show-closed-move' into 'master'

Allow close status to be shown if issue is locked

See merge request gitlab-org/gitlab!16685
parents 6434a36e 8a16309b
...@@ -64,6 +64,15 @@ module IssuesHelper ...@@ -64,6 +64,15 @@ module IssuesHelper
end end
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) def issue_button_visibility(issue, closed)
return 'hidden' if issue_button_hidden?(issue, closed) return 'hidden' if issue_button_hidden?(issue, closed)
end end
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
.detail-page-header .detail-page-header
.detail-page-header-body .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') = sprite_icon('mobile-issue-close', size: 16, css_class: 'd-block d-sm-none')
.d-none.d-sm-block .d-none.d-sm-block
= issue_closed_text(@issue, current_user) = 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') = sprite_icon('issue-open-m', size: 16, css_class: 'd-block d-sm-none')
%span.d-none.d-sm-block Open %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 ...@@ -40,6 +40,13 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)') expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)')
end 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 it 'links "moved" to the new issue the original issue was moved to' do
render render
...@@ -95,12 +102,19 @@ describe 'projects/issues/show' do ...@@ -95,12 +102,19 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed') expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed')
end 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 end
context 'when the issue is open' do context 'when the issue is open' do
before do before do
allow(issue).to receive(:closed?).and_return(false) 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 end
it 'shows "Open" if an issue has been moved' do it 'shows "Open" if an issue has been moved' do
...@@ -108,5 +122,12 @@ describe 'projects/issues/show' do ...@@ -108,5 +122,12 @@ describe 'projects/issues/show' do
expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open') expect(rendered).to have_selector('.status-box-open:not(.hidden)', text: 'Open')
end 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
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