Class: Gitlab::SlashCommands::Help

Inherits:
BaseCommand show all
Defined in:
lib/gitlab/slash_commands/help.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::QUERY_LIMIT

Instance Attribute Summary

Attributes inherited from BaseCommand

#chat_name, #current_user, #params, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

available?, can?, #collection, #initialize

Constructor Details

This class inherits a constructor from Gitlab::SlashCommands::BaseCommand

Class Method Details

.allowed?(_project, _user) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/gitlab/slash_commands/help.rb', line 17

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

.help_messageObject



13
14
15
# File 'lib/gitlab/slash_commands/help.rb', line 13

def self.help_message
  'help'
end

.match(_text) ⇒ Object

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



9
10
11
# File 'lib/gitlab/slash_commands/help.rb', line 9

def self.match(_text)
  true
end

Instance Method Details

#execute(commands, text) ⇒ Object



21
22
23
24
25
# File 'lib/gitlab/slash_commands/help.rb', line 21

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

#triggerObject



27
28
29
# File 'lib/gitlab/slash_commands/help.rb', line 27

def trigger
  params[:command]
end