Class: Projects::Alerting::NotifyService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize, IncidentManagement::Settings
Defined in:
app/services/projects/alerting/notify_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from IncidentManagement::Settings

#auto_close_incident?, #incident_management_setting, #process_issues?

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseService

#initialize

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

This class inherits a constructor from BaseService

Instance Method Details

#execute(token) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/projects/alerting/notify_service.rb', line 9

def execute(token)
  return forbidden unless alerts_service_activated?
  return unauthorized unless valid_token?(token)

  alert = process_alert
  return bad_request unless alert.persisted?

  process_incident_issues(alert) if process_issues?
  send_alert_email if send_email?

  ServiceResponse.success
rescue Gitlab::Alerting::NotificationPayloadParser::BadPayloadError
  bad_request
end