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:
authorShinya Maeda <shinya@gitlab.com>2019-04-29 10:29:54 +0300
committerShinya Maeda <shinya@gitlab.com>2019-04-30 06:14:19 +0300
commit96b28d8387b97afae5a77eb6a4b240b67b1ced7f (patch)
tree3fb6882e8927e19cfeac866136cdc8157c22b4a1 /app/presenters/merge_request_presenter.rb
parentf109d24ddca8d15c315d0283dd54e0be44ce2c42 (diff)
Fix ref_text of merge request pipelines
Source branch can be removed after the merge and we have to make sure to avoid rendering links if it's the case.
Diffstat (limited to 'app/presenters/merge_request_presenter.rb')
-rw-r--r--app/presenters/merge_request_presenter.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb
index 3f7b5bebb74..ba0711ca867 100644
--- a/app/presenters/merge_request_presenter.rb
+++ b/app/presenters/merge_request_presenter.rb
@@ -216,6 +216,22 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
help_page_path('ci/merge_request_pipelines/index.md')
end
+ def source_branch_link
+ if source_branch_exists?
+ link_to(source_branch, source_branch_commits_path, class: 'ref-name')
+ else
+ content_tag(:span, source_branch, class: 'ref-name')
+ end
+ end
+
+ def target_branch_link
+ if target_branch_exists?
+ link_to(target_branch, target_branch_commits_path, class: 'ref-name')
+ else
+ content_tag(:span, target_branch, class: 'ref-name')
+ end
+ end
+
private
def cached_can_be_reverted?