diff options
author | Rémy Coutable <remy@rymai.me> | 2016-08-10 14:12:09 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-08-13 00:06:12 +0200 |
commit | 23db6449542498636c145e83c71a4a466eb62746 (patch) | |
tree | 34619a5bccfe7864c29abfefc61268b5da86d35a /lib/gitlab | |
parent | e021604454f1093b7d762b28eae36e30083f0053 (diff) | |
download | gitlab-ce-23db6449542498636c145e83c71a4a466eb62746.tar.gz |
Add support for no-op slash commands that appear in autocomplete
The first one is /cc
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/slash_commands/dsl.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/gitlab/slash_commands/dsl.rb b/lib/gitlab/slash_commands/dsl.rb index 3ded4109f2e..edfe8405876 100644 --- a/lib/gitlab/slash_commands/dsl.rb +++ b/lib/gitlab/slash_commands/dsl.rb @@ -14,8 +14,10 @@ module Gitlab def command_names command_definitions.flat_map do |command_definition| - [command_definition[:name], command_definition[:aliases]].flatten - end + unless command_definition[:noop] + [command_definition[:name], command_definition[:aliases]].flatten + end + end.compact end # Allows to give a description to the next slash command @@ -28,6 +30,11 @@ module Gitlab @params = params end + # Allows to define if a command is a no-op, but should appear in autocomplete + def noop(noop) + @noop = noop + end + # Registers a new command which is recognizeable # from body of email or comment. # Example: @@ -63,7 +70,8 @@ module Gitlab name: command_name, aliases: aliases, description: @description || '', - params: @params || [] + params: @params || [], + noop: @noop || false } @command_definitions << command_definition |