Class: IncidentManagement::TimelineEvents::DestroyService
- Inherits:
-
BaseService
- Object
- BaseService
- IncidentManagement::TimelineEvents::DestroyService
- Defined in:
- app/services/incident_management/timeline_events/destroy_service.rb
Constant Summary
Constants included from Gitlab::Utils::UsageData
Gitlab::Utils::UsageData::DISTRIBUTED_HLL_FALLBACK, Gitlab::Utils::UsageData::FALLBACK, Gitlab::Utils::UsageData::HISTOGRAM_FALLBACK, Gitlab::Utils::UsageData::MAX_BUCKET_SIZE
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(timeline_event, user) ⇒ DestroyService
constructor
A new instance of DestroyService.
Methods inherited from BaseService
#allowed?, #auto_create_predefined_tags, #error, #error_in_save, #error_no_permissions, #success, #track_timeline_event
Methods included from Gitlab::Utils::UsageData
#add, #add_metric, #alt_usage_data, #average, #count, #distinct_count, #estimate_batch_distinct_count, #histogram, #maximum_id, #measure_duration, #minimum_id, #redis_usage_data, #sum, #track_usage_event, #with_finished_at, #with_metadata, #with_prometheus_client
Constructor Details
#initialize(timeline_event, user) ⇒ DestroyService
Returns a new instance of DestroyService.
8 9 10 11 12 13 |
# File 'app/services/incident_management/timeline_events/destroy_service.rb', line 8 def initialize(timeline_event, user) @timeline_event = timeline_event @user = user @incident = timeline_event.incident @project = @incident.project end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/incident_management/timeline_events/destroy_service.rb', line 15 def execute return unless allowed? if timeline_event.destroy add_system_note(incident, user) track_timeline_event('incident_management_timeline_event_deleted', project) success(timeline_event) else error_in_save(timeline_event) end end |