gitlab-org--gitlab-foss/app/presenters/commit_presenter.rb

20 lines
428 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-06-28 03:30:29 -04:00
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
2019-06-28 03:30:29 -04:00
def web_url
Gitlab::UrlBuilder.new(commit).url
end
end