debian-mirror-gitlab/app/presenters/ci/trigger_presenter.rb
2021-11-18 22:05:49 +05:30

20 lines
392 B
Ruby

# frozen_string_literal: true
module Ci
class TriggerPresenter < Gitlab::View::Presenter::Delegated
presents ::Ci::Trigger, as: :trigger
def has_token_exposed?
can?(current_user, :admin_trigger, trigger)
end
delegator_override :token
def token
if has_token_exposed?
trigger.token
else
trigger.short_token
end
end
end
end