Class: Gitlab::SlashCommands::IncidentManagement::IncidentNew

Inherits:
IncidentCommand show all
Defined in:
lib/gitlab/slash_commands/incident_management/incident_new.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::QUERY_LIMIT

Instance Attribute Summary

Attributes inherited from BaseCommand

#chat_name, #current_user, #params, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IncidentCommand

available?, #collection, #slack_installation

Methods inherited from BaseCommand

available?, can?, #collection, #initialize

Constructor Details

This class inherits a constructor from Gitlab::SlashCommands::BaseCommand

Class Method Details

.allowed?(_project, _user) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/gitlab/slash_commands/incident_management/incident_new.rb', line 11

def self.allowed?(_project, _user)
  Feature.enabled?(:incident_declare_slash_command)
end

.help_messageObject



7
8
9
# File 'lib/gitlab/slash_commands/incident_management/incident_new.rb', line 7

def self.help_message
  'incident declare *(Beta)*'
end

.match(text) ⇒ Object



15
16
17
# File 'lib/gitlab/slash_commands/incident_management/incident_new.rb', line 15

def self.match(text)
  text == 'incident declare'
end

Instance Method Details

#execute(_match) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/gitlab/slash_commands/incident_management/incident_new.rb', line 19

def execute(_match)
  response = ::Integrations::SlackInteractions::IncidentManagement::IncidentModalOpenedService
  .new(slack_installation, current_user, params)
  .execute

  presenter.present(response.message)
end