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
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-16 06:08:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-16 06:08:00 +0300
commit21de0d5578ba4b6e4f7ad0667ecdaaf0810f4235 (patch)
tree9654b9909863ab0f7c016ebb03f18d483fbf1227 /app
parentd112e55353f587f94a8fb485c1c2c50310e381ac (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/presenters/ci/pipeline_presenter.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb
index 37dbc2918ec..6c7608b8067 100644
--- a/app/presenters/ci/pipeline_presenter.rb
+++ b/app/presenters/ci/pipeline_presenter.rb
@@ -82,6 +82,12 @@ module Ci
link_to_merge_request_source_branch: link_to_merge_request_source_branch,
link_to_merge_request_target_branch: link_to_merge_request_target_branch
}
+ elsif all_related_merge_requests.any?
+ (_("%{count} related %{pluralized_subject}: %{links}") % {
+ count: all_related_merge_requests.count,
+ pluralized_subject: n_('merge request', 'merge requests', all_related_merge_requests.count),
+ links: all_related_merge_request_links.join(', ')
+ }).html_safe
elsif pipeline.ref && pipeline.ref_exists?
_("For %{link_to_pipeline_ref}")
.html_safe % { link_to_pipeline_ref: link_to_pipeline_ref }
@@ -140,6 +146,24 @@ module Ci
end
end
end
+
+ def all_related_merge_request_links
+ all_related_merge_requests.map do |merge_request|
+ mr_path = project_merge_request_path(merge_request.project, merge_request)
+
+ ApplicationController.helpers.link_to "#{merge_request.to_reference} #{merge_request.title}", mr_path, class: 'mr-iid'
+ end
+ end
+
+ def all_related_merge_requests
+ strong_memoize(:all_related_merge_requests) do
+ if pipeline.ref && can?(current_user, :read_merge_request, pipeline.project)
+ pipeline.all_merge_requests_by_recency
+ else
+ []
+ end
+ end
+ end
end
end