summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-30 09:08:55 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-30 09:08:55 +0000
commitbe37a0ee5e3e3dbb967266248f0f46f14a9931e2 (patch)
tree8fd575a36933fb847a6f92ff76d9c1ad908a3f7b /app/presenters
parent6305f1dc00870f6e0635e2e850538a00bbd00bda (diff)
downloadgitlab-ce-be37a0ee5e3e3dbb967266248f0f46f14a9931e2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/ci/pipeline_presenter.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb
index f01ff56540a..b113c7043e7 100644
--- a/app/presenters/ci/pipeline_presenter.rb
+++ b/app/presenters/ci/pipeline_presenter.rb
@@ -70,18 +70,22 @@ module Ci
end
end
- def all_related_merge_request_text
+ def all_related_merge_request_text(limit: nil)
if all_related_merge_requests.none?
- 'No related merge requests found.'
+ _("No related merge requests found.")
else
_("%{count} related %{pluralized_subject}: %{links}" % {
count: all_related_merge_requests.count,
- pluralized_subject: 'merge request'.pluralize(all_related_merge_requests.count),
- links: all_related_merge_request_links.join(', ')
+ pluralized_subject: n_('merge request', 'merge requests', all_related_merge_requests.count),
+ links: all_related_merge_request_links(limit: limit).join(', ')
}).html_safe
end
end
+ def has_many_merge_requests?
+ all_related_merge_requests.count > 1
+ end
+
def link_to_pipeline_ref
link_to(pipeline.ref,
project_commits_path(pipeline.project, pipeline.ref),
@@ -118,8 +122,10 @@ module Ci
end
end
- def all_related_merge_request_links
- all_related_merge_requests.map do |merge_request|
+ def all_related_merge_request_links(limit: nil)
+ limit ||= all_related_merge_requests.count
+
+ all_related_merge_requests.first(limit).map do |merge_request|
mr_path = project_merge_request_path(merge_request.project, merge_request)
link_to "#{merge_request.to_reference} #{merge_request.title}", mr_path, class: 'mr-iid'