gitlab-org--gitlab-foss/lib/gitlab/slash_commands/base_command.rb
Eric Eastwood ea090291bb Rename "Slash commands" to "Quick actions"
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27070

Deprecate "chat commands" in favor of "slash commands"

We looked for things like:

 - `slash commmand`
 - `slash_command`
 - `slash-command`
 - `SlashCommand`
2017-06-15 09:01:56 -05:00

47 lines
902 B
Ruby

module Gitlab
module SlashCommands
class BaseCommand
QUERY_LIMIT = 5
def self.match(_text)
raise NotImplementedError
end
def self.help_message
raise NotImplementedError
end
def self.available?(_project)
raise NotImplementedError
end
def self.allowed?(_user, _ability)
true
end
def self.can?(object, action, subject)
Ability.allowed?(object, action, subject)
end
def execute(_)
raise NotImplementedError
end
def collection
raise NotImplementedError
end
attr_accessor :project, :current_user, :params
def initialize(project, user, params = {})
@project, @current_user, @params = project, user, params.dup
end
private
def find_by_iid(iid)
collection.find_by(iid: iid)
end
end
end
end