summaryrefslogtreecommitdiff
path: root/lib/gitlab/chat_commands/presenter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/chat_commands/presenter.rb')
-rw-r--r--lib/gitlab/chat_commands/presenter.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/chat_commands/presenter.rb b/lib/gitlab/chat_commands/presenter.rb
index caceaa25391..8930a21f406 100644
--- a/lib/gitlab/chat_commands/presenter.rb
+++ b/lib/gitlab/chat_commands/presenter.rb
@@ -30,12 +30,12 @@ module Gitlab
if subject.is_a?(Gitlab::ChatCommands::Result)
show_result(subject)
elsif subject.respond_to?(:count)
- if subject.many?
- multiple_resources(subject)
- elsif subject.none?
+ if subject.none?
not_found
+ elsif subject.one?
+ single_resource(subject.first)
else
- single_resource(subject)
+ multiple_resources(subject)
end
else
single_resource(subject)
@@ -71,9 +71,9 @@ module Gitlab
end
def multiple_resources(resources)
- resources.map! { |resource| title(resource) }
+ titles = resources.map { |resource| title(resource) }
- message = header_with_list("Multiple results were found:", resources)
+ message = header_with_list("Multiple results were found:", titles)
ephemeral_response(message)
end