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

module Ci
  class TriggerPresenter < Gitlab::View::Presenter::Delegated
    presents :trigger

    def has_token_exposed?
      can?(current_user, :admin_trigger, trigger)
    end

    def token
      if has_token_exposed?
        trigger.token
      else
        trigger.short_token
      end
    end
  end
end