summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-06-04 12:42:02 +0000
committerNick Thomas <nick@gitlab.com>2018-06-04 12:42:02 +0000
commit4f20bf956a179bc4ffdfa23168925c102eb2e88b (patch)
tree5057dbed707133d0b5af35823cae72109f768b1f
parent848ecbc7a608882517516045baf7d162f64e1ad1 (diff)
downloadgitlab-ce-4f20bf956a179bc4ffdfa23168925c102eb2e88b.tar.gz
Backport EE SlashCommand Refactor
-rw-r--r--lib/gitlab/slash_commands/command.rb18
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