summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-02-22 15:44:05 +0000
committerRuben Davila <rdavila84@gmail.com>2017-02-27 23:41:08 -0500
commit7efd5f8bfbf62d11999304acbb7baa30a876e9b0 (patch)
tree1ffd5a25155c5ee9357b16de36f553e884580f5a
parentf8e0216f04e8d1016543a965f67d84b181e4efb9 (diff)
downloadgitlab-ce-7efd5f8bfbf62d11999304acbb7baa30a876e9b0.tar.gz
Merge branch 'zj-fix-slash-command-labels' into 'master'
Chat slash commands show labels correctly Closes #28358 See merge request !9408
-rw-r--r--changelogs/unreleased/zj-fix-slash-command-labels.yml4
-rw-r--r--lib/gitlab/chat_commands/presenters/issuable.rb2
-rw-r--r--spec/lib/gitlab/chat_commands/presenters/issue_show_spec.rb15
3 files changed, 20 insertions, 1 deletions
diff --git a/changelogs/unreleased/zj-fix-slash-command-labels.yml b/changelogs/unreleased/zj-fix-slash-command-labels.yml
new file mode 100644
index 00000000000..93b7194dd4e
--- /dev/null
+++ b/changelogs/unreleased/zj-fix-slash-command-labels.yml
@@ -0,0 +1,4 @@
+---
+title: Chat slash commands show labels correctly
+merge_request:
+author:
diff --git a/lib/gitlab/chat_commands/presenters/issuable.rb b/lib/gitlab/chat_commands/presenters/issuable.rb
index dfb1c8f6616..035eb780162 100644
--- a/lib/gitlab/chat_commands/presenters/issuable.rb
+++ b/lib/gitlab/chat_commands/presenters/issuable.rb
@@ -32,7 +32,7 @@ module Gitlab
},
{
title: "Labels",
- value: @resource.labels.any? ? @resource.label_names : "_None_",
+ value: @resource.labels.any? ? @resource.label_names.join(', ') : "_None_",
short: true
}
]
diff --git a/spec/lib/gitlab/chat_commands/presenters/issue_show_spec.rb b/spec/lib/gitlab/chat_commands/presenters/issue_show_spec.rb
index 5b678d31fce..3916fc704a4 100644
--- a/spec/lib/gitlab/chat_commands/presenters/issue_show_spec.rb
+++ b/spec/lib/gitlab/chat_commands/presenters/issue_show_spec.rb
@@ -26,6 +26,21 @@ describe Gitlab::ChatCommands::Presenters::IssueShow do
end
end
+ context 'with labels' do
+ let(:label) { create(:label, project: project, title: 'mep') }
+ let(:label1) { create(:label, project: project, title: 'mop') }
+
+ before do
+ issue.labels << [label, label1]
+ end
+
+ it 'shows the labels' do
+ labels = attachment[:fields].find { |f| f[:title] == 'Labels' }
+
+ expect(labels[:value]).to eq("mep, mop")
+ end
+ end
+
context 'confidential issue' do
let(:issue) { create(:issue, project: project) }