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:
Diffstat (limited to 'app/presenters/event_presenter.rb')
-rw-r--r--app/presenters/event_presenter.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/presenters/event_presenter.rb b/app/presenters/event_presenter.rb
index a098db7fbbc..8f7b2d5868e 100644
--- a/app/presenters/event_presenter.rb
+++ b/app/presenters/event_presenter.rb
@@ -54,4 +54,29 @@ class EventPresenter < Gitlab::View::Presenter::Delegated
target.noteable_type.titleize
end.downcase
end
+
+ def push_activity_description
+ return unless push_action?
+
+ if batch_push?
+ "#{action_name} #{ref_count} #{ref_type.pluralize(ref_count)}"
+ else
+ "#{action_name} #{ref_type}"
+ end
+ end
+
+ def batch_push?
+ push_action? && ref_count.to_i > 0
+ end
+
+ def linked_to_reference?
+ return false unless push_action?
+ return false if event.project.nil?
+
+ if tag?
+ project.repository.tag_exists?(ref_name)
+ else
+ project.repository.branch_exists?(ref_name)
+ end
+ end
end