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.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/presenters/commit_presenter.rb b/app/presenters/commit_presenter.rb
new file mode 100644
index 00000000000..05adbe1d4f5
--- /dev/null
+++ b/app/presenters/commit_presenter.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class CommitPresenter < Gitlab::View::Presenter::Simple
+ presents :commit
+
+ def status_for(ref)
+ can?(current_user, :read_commit_status, commit.project) && commit.status(ref)
+ end
+
+ def any_pipelines?
+ can?(current_user, :read_pipeline, commit.project) && commit.pipelines.any?
+ end
+end