diff options
author | Mark Chao <mchao@gitlab.com> | 2018-06-04 15:42:02 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-06-04 15:42:02 +0300 |
commit | 4f20bf956a179bc4ffdfa23168925c102eb2e88b (patch) | |
tree | 5057dbed707133d0b5af35823cae72109f768b1f /lib | |
parent | 848ecbc7a608882517516045baf7d162f64e1ad1 (diff) |
Backport EE SlashCommand Refactor
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/slash_commands/command.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/gitlab/slash_commands/command.rb b/lib/gitlab/slash_commands/command.rb index bb778f37096..c82320a6036 100644 --- a/lib/gitlab/slash_commands/command.rb +++ b/lib/gitlab/slash_commands/command.rb @@ -1,13 +1,15 @@ module Gitlab module SlashCommands class Command < BaseCommand - COMMANDS = [ - Gitlab::SlashCommands::IssueShow, - Gitlab::SlashCommands::IssueNew, - Gitlab::SlashCommands::IssueSearch, - Gitlab::SlashCommands::IssueMove, - Gitlab::SlashCommands::Deploy - ].freeze + def self.commands + [ + Gitlab::SlashCommands::IssueShow, + Gitlab::SlashCommands::IssueNew, + Gitlab::SlashCommands::IssueSearch, + Gitlab::SlashCommands::IssueMove, + Gitlab::SlashCommands::Deploy + ] + end def execute command, match = match_command @@ -37,7 +39,7 @@ module Gitlab private def available_commands - COMMANDS.select do |klass| + self.class.commands.keep_if do |klass| klass.available?(project) end end |