summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-02-21 09:53:44 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-02-21 14:20:08 +0100
commit63bd79f594272d98ce022685f26a47ce0afae9d4 (patch)
treeeaecca72bb9b8afd15512b2461fa156e09944b70
parentb596dd8fedd9dc8f9487e1e67a52a7b211bd956b (diff)
downloadgitlab-ce-zj-fix-slash-command-labels.tar.gz
Chat slash commands show labels correctlyzj-fix-slash-command-labels
-rw-r--r--changelogs/unreleased/zj-fix-slash-command-labels.yml4
-rw-r--r--lib/gitlab/chat_commands/presenters/issue_base.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/issue_base.rb b/lib/gitlab/chat_commands/presenters/issue_base.rb
index a0058407fb2..054f7f4be0c 100644
--- a/lib/gitlab/chat_commands/presenters/issue_base.rb
+++ b/lib/gitlab/chat_commands/presenters/issue_base.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) }