Class: CommitPresenter
- Inherits:
-
Gitlab::View::Presenter::Delegated
- Object
- SimpleDelegator
- Gitlab::View::Presenter::Delegated
- CommitPresenter
- Defined in:
- app/presenters/commit_presenter.rb
Instance Method Summary collapse
- #any_pipelines? ⇒ Boolean
- #detailed_status_for(ref) ⇒ Object
- #signature_html ⇒ Object
- #status_for(ref = nil) ⇒ Object
- #tags_for_display ⇒ Object
Methods inherited from Gitlab::View::Presenter::Delegated
Methods included from Gitlab::Utils::DelegatorOverride
#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!
Methods included from Gitlab::View::Presenter::Base
#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url
Methods included from Gitlab::Allowable
Methods included from Gitlab::Routing
includes_helpers, redirect_legacy_paths, url_helpers
Constructor Details
This class inherits a constructor from Gitlab::View::Presenter::Delegated
Instance Method Details
#any_pipelines? ⇒ Boolean
20 21 22 23 24 |
# File 'app/presenters/commit_presenter.rb', line 20 def any_pipelines? return false unless can?(current_user, :read_pipeline, commit.project) commit.pipelines.any? end |
#detailed_status_for(ref) ⇒ Object
6 7 8 9 10 11 |
# File 'app/presenters/commit_presenter.rb', line 6 def detailed_status_for(ref) return unless can?(current_user, :read_pipeline, commit.latest_pipeline(ref)) return unless can?(current_user, :read_commit_status, commit.project) commit.latest_pipeline(ref)&.detailed_status(current_user) end |
#signature_html ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/presenters/commit_presenter.rb', line 30 def signature_html return unless commit.has_signature? ApplicationController.renderer.render( 'projects/commit/_signature', locals: { signature: commit.signature }, layout: false, formats: [:html] ) end |
#status_for(ref = nil) ⇒ Object
13 14 15 16 17 18 |
# File 'app/presenters/commit_presenter.rb', line 13 def status_for(ref = nil) return unless can?(current_user, :read_pipeline, commit.latest_pipeline(ref)) return unless can?(current_user, :read_commit_status, commit.project) commit.status(ref) end |