summaryrefslogtreecommitdiff
path: root/app/services/resource_events
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/resource_events')
-rw-r--r--app/services/resource_events/change_labels_service.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/resource_events/change_labels_service.rb b/app/services/resource_events/change_labels_service.rb
index 03ac839c509..04f917ec8ef 100644
--- a/app/services/resource_events/change_labels_service.rb
+++ b/app/services/resource_events/change_labels_service.rb
@@ -24,6 +24,9 @@ module ResourceEvents
end
ApplicationRecord.legacy_bulk_insert(ResourceLabelEvent.table_name, labels) # rubocop:disable Gitlab/BulkInsert
+
+ create_timeline_events_from(added_labels: added_labels, removed_labels: removed_labels)
+
resource.expire_note_etag_cache
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_label_changed_action(author: user) if resource.is_a?(Issue)
@@ -41,6 +44,17 @@ module ResourceEvents
raise ArgumentError, "Unknown resource type #{resource.class.name}"
end
end
+
+ def create_timeline_events_from(added_labels: [], removed_labels: [])
+ return unless resource.incident?
+
+ IncidentManagement::TimelineEvents::CreateService.change_labels(
+ resource,
+ user,
+ added_labels: added_labels,
+ removed_labels: removed_labels
+ )
+ end
end
end