Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-23 17:31:48 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-23 18:50:10 +0300
commit811262eb933a0c80fcbfb6818d2fc81e264c75f0 (patch)
treec2924235c0784fde32c54813a6fa423b7dbd4780 /lib/gitlab
parent66cf66dc85cc873b62ad441c77b0db6516bef929 (diff)
Merge branch 'zj-fix-issue-search-chat-command' into 'master'
Fix errorcode 500 on slash commands Closes #26013 See merge request !8285
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/chat_commands/deploy.rb5
-rw-r--r--lib/gitlab/chat_commands/presenter.rb12
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/gitlab/chat_commands/deploy.rb b/lib/gitlab/chat_commands/deploy.rb
index 6bb854dc080..0f70323810d 100644
--- a/lib/gitlab/chat_commands/deploy.rb
+++ b/lib/gitlab/chat_commands/deploy.rb
@@ -49,8 +49,9 @@ module Gitlab
end
def url(subject)
- polymorphic_url(
- [ subject.project.namespace.becomes(Namespace), subject.project, subject ])
+ project = subject.project
+
+ namespace_project_build_url(project.namespace.becomes(Namespace), project, subject)
end
end
end
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