summaryrefslogtreecommitdiff
path: root/lib/gitlab/slash_commands/help.rb
blob: 81f3707e03e4a735ed1dcc664c68f9f05bf84f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Gitlab
  module SlashCommands
    class Help < BaseCommand
      # This class has to be used last, as it always matches. It has to match
      # because other commands were not triggered and we want to show the help
      # command
      def self.match(_text)
        true
      end

      def self.help_message
        'help'
      end

      def self.allowed?(_project, _user)
        true
      end

      def execute(commands, text)
        Gitlab::SlashCommands::Presenters::Help.new(commands).present(trigger, text)
      end

      def trigger
        params[:command]
      end
    end
  end
end