diff options
Diffstat (limited to 'app/presenters/commit_presenter.rb')
-rw-r--r-- | app/presenters/commit_presenter.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/presenters/commit_presenter.rb b/app/presenters/commit_presenter.rb index fc9853733c1..94fc8ac8e39 100644 --- a/app/presenters/commit_presenter.rb +++ b/app/presenters/commit_presenter.rb @@ -6,14 +6,29 @@ class CommitPresenter < Gitlab::View::Presenter::Delegated presents :commit def status_for(ref) - can?(current_user, :read_commit_status, commit.project) && commit.status(ref) + return unless can?(current_user, :read_commit_status, commit.project) + + commit.latest_pipeline(ref)&.detailed_status(current_user) end def any_pipelines? - can?(current_user, :read_pipeline, commit.project) && commit.pipelines.any? + return false unless can?(current_user, :read_pipeline, commit.project) + + commit.pipelines.any? end def web_url Gitlab::UrlBuilder.new(commit).url end + + def signature_html + return unless commit.has_signature? + + ApplicationController.renderer.render( + 'projects/commit/_signature', + locals: { signature: commit.signature }, + layout: false, + formats: [:html] + ) + end end |