summaryrefslogtreecommitdiff
path: root/app/presenters/commit_presenter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/presenters/commit_presenter.rb')
-rw-r--r--app/presenters/commit_presenter.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/presenters/commit_presenter.rb b/app/presenters/commit_presenter.rb
index 7df45ca03bb..2cb88179845 100644
--- a/app/presenters/commit_presenter.rb
+++ b/app/presenters/commit_presenter.rb
@@ -5,12 +5,20 @@ class CommitPresenter < Gitlab::View::Presenter::Delegated
presents ::Commit, as: :commit
- def status_for(ref)
+ 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
+ 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
+
def any_pipelines?
return false unless can?(current_user, :read_pipeline, commit.project)