diff options
Diffstat (limited to 'app/workers/projects/post_creation_worker.rb')
-rw-r--r-- | app/workers/projects/post_creation_worker.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/workers/projects/post_creation_worker.rb b/app/workers/projects/post_creation_worker.rb index 3a39bd17ce3..886919ecace 100644 --- a/app/workers/projects/post_creation_worker.rb +++ b/app/workers/projects/post_creation_worker.rb @@ -17,6 +17,7 @@ module Projects return unless project create_prometheus_integration(project) + create_incident_management_timeline_event_tags(project) end private @@ -34,5 +35,19 @@ module Projects rescue ActiveRecord::RecordInvalid => e Gitlab::ErrorTracking.track_exception(e, extra: { project_id: project.id }) end + + def create_incident_management_timeline_event_tags(project) + tags = project.incident_management_timeline_event_tags.pluck_names + start_time_name = ::IncidentManagement::TimelineEventTag::START_TIME_TAG_NAME + end_time_name = ::IncidentManagement::TimelineEventTag::END_TIME_TAG_NAME + + project.incident_management_timeline_event_tags.new(name: start_time_name) unless tags.include?(start_time_name) + + project.incident_management_timeline_event_tags.new(name: end_time_name) unless tags.include?(end_time_name) + + project.save! + rescue StandardError => e + Gitlab::ErrorTracking.track_exception(e, extra: { project_id: project.id }) + end end end |