summaryrefslogtreecommitdiff
path: root/app/presenters/commit_presenter.rb
blob: fc9853733c1465e471684cd723018ebbc4feb236 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class CommitPresenter < Gitlab::View::Presenter::Delegated
  include GlobalID::Identification

  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

  def web_url
    Gitlab::UrlBuilder.new(commit).url
  end
end