summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:18:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:18:51 +0000
commitbdbded586beb38e2ee4642c6a1e78ccbebc094dc (patch)
treeb4ed16e070e6fc4ff99fcb353bc1af1ae0d066bd
parent80f61b4035607d7cd87de993b8f5e996bde3481f (diff)
downloadgitlab-ce-bdbded586beb38e2ee4642c6a1e78ccbebc094dc.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/helpers/issues_helper.rb9
-rw-r--r--app/views/projects/issues/show.html.haml4
-rw-r--r--changelogs/unreleased/bw-show-closed-move.yml5
-rw-r--r--spec/views/projects/issues/show.html.haml_spec.rb23
4 files changed, 38 insertions, 3 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index d11b0594632..6375513f514 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -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
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index 1843ad7bb75..17f6fe95f10 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -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
diff --git a/changelogs/unreleased/bw-show-closed-move.yml b/changelogs/unreleased/bw-show-closed-move.yml
new file mode 100644
index 00000000000..a344f20ee95
--- /dev/null
+++ b/changelogs/unreleased/bw-show-closed-move.yml
@@ -0,0 +1,5 @@
+---
+title: Allow close status to be shown on locked issues
+merge_request: 16685
+author:
+type: fixed
diff --git a/spec/views/projects/issues/show.html.haml_spec.rb b/spec/views/projects/issues/show.html.haml_spec.rb
index d734d0b4a20..d34b1735445 100644
--- a/spec/views/projects/issues/show.html.haml_spec.rb
+++ b/spec/views/projects/issues/show.html.haml_spec.rb
@@ -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