mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-13 14:44:59 +00:00

This improves the output produced when running an unknown command, running the "help" command, and when trying to run a command you are not allowed to run. The new help output includes links to the project of the chatops integration, and a link to the chatops documentation.
33 lines
673 B
Ruby
33 lines
673 B
Ruby
# frozen_string_literal: true
|
|
|
|
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(project, commands)
|
|
.present(trigger, text)
|
|
end
|
|
|
|
def trigger
|
|
params[:command]
|
|
end
|
|
end
|
|
end
|
|
end
|