Class: IncidentManagement::LinkAlerts::DestroyService

Inherits:
BaseService show all
Defined in:
app/services/incident_management/link_alerts/destroy_service.rb

Instance Attribute Summary

Attributes inherited from BaseProjectService

#project

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(incident, current_user, alert) ⇒ DestroyService

Returns a new instance of DestroyService.

Parameters:



9
10
11
12
13
14
15
# File 'app/services/incident_management/link_alerts/destroy_service.rb', line 9

def initialize(incident, current_user, alert)
  @incident = incident
  @current_user = current_user
  @alert = alert

  super(project: incident.project, current_user: current_user)
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
# File 'app/services/incident_management/link_alerts/destroy_service.rb', line 17

def execute
  return error_no_permissions unless allowed?

  incident.alert_management_alerts.delete(alert)

  success
end