debian-mirror-gitlab/app/presenters/ci/trigger_presenter.rb

21 lines
392 B
Ruby
Raw Normal View History

2019-02-02 18:00:53 +05:30
# frozen_string_literal: true
module Ci
class TriggerPresenter < Gitlab::View::Presenter::Delegated
2021-11-18 22:05:49 +05:30
presents ::Ci::Trigger, as: :trigger
2019-02-02 18:00:53 +05:30
def has_token_exposed?
can?(current_user, :admin_trigger, trigger)
end
2021-11-18 22:05:49 +05:30
delegator_override :token
2019-02-02 18:00:53 +05:30
def token
if has_token_exposed?
trigger.token
else
trigger.short_token
end
end
end
end