Class: SystemNotes::IncidentService
- Inherits:
-
BaseService
- Object
- BaseService
- SystemNotes::IncidentService
- Defined in:
- app/services/system_notes/incident_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
-
#change_incident_severity ⇒ Object
Called when the severity of an Incident has changed.
-
#change_incident_status(reason) ⇒ Object
Called when the status of an IncidentManagement::IssuableEscalationStatus has changed.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from SystemNotes::BaseService
Instance Method Details
#change_incident_severity ⇒ Object
Called when the severity of an Incident has changed
Example Note text:
"changed the severity to Medium - S3"
Returns the created Note object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/system_notes/incident_service.rb', line 12 def change_incident_severity severity = noteable.severity if severity_label = IssuableSeverity::SEVERITY_LABELS[severity.to_sym] body = "changed the severity to **#{severity_label}**" create_note(NoteSummary.new(noteable, project, , body, action: 'severity')) else Gitlab::AppLogger.error( message: 'Cannot create a system note for severity change', noteable_class: noteable.class.to_s, noteable_id: noteable.id, severity: severity ) end end |
#change_incident_status(reason) ⇒ Object
Called when the status of an IncidentManagement::IssuableEscalationStatus has changed
reason - String.
Example Note text:
"changed the incident status to Acknowledged"
"changed the incident status to Acknowledged by changing the status of ^alert#540"
Returns the created Note object
39 40 41 42 43 44 |
# File 'app/services/system_notes/incident_service.rb', line 39 def change_incident_status(reason) status = noteable.escalation_status.status_name.to_s.titleize body = "changed the incident status to **#{status}**#{reason}" create_note(NoteSummary.new(noteable, project, , body, action: 'status')) end |