diff options
Diffstat (limited to 'lib/gitlab/chat_commands/command.rb')
-rw-r--r-- | lib/gitlab/chat_commands/command.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/gitlab/chat_commands/command.rb b/lib/gitlab/chat_commands/command.rb deleted file mode 100644 index 3e0c30c33b7..00000000000 --- a/lib/gitlab/chat_commands/command.rb +++ /dev/null @@ -1,44 +0,0 @@ -module Gitlab - module ChatCommands - class Command < BaseCommand - COMMANDS = [ - Gitlab::ChatCommands::IssueShow, - Gitlab::ChatCommands::IssueNew, - Gitlab::ChatCommands::IssueSearch, - Gitlab::ChatCommands::Deploy - ].freeze - - def execute - command, match = match_command - - if command - if command.allowed?(project, current_user) - command.new(project, current_user, params).execute(match) - else - Gitlab::ChatCommands::Presenters::Access.new.access_denied - end - else - Gitlab::ChatCommands::Help.new(project, current_user, params).execute(available_commands, params[:text]) - end - end - - def match_command - match = nil - service = - available_commands.find do |klass| - match = klass.match(params[:text]) - end - - [service, match] - end - - private - - def available_commands - COMMANDS.select do |klass| - klass.available?(project) - end - end - end - end -end |