Commit 7772788a authored by Felipe Artur's avatar Felipe Artur

Move incident tracking module to correct services

IncidentManagement::UsageData was being included
for modules that do not use it, for example,
EpicLink::DestroyService and others.
This moves its inclusion into correct files.
parent 4c61a186
......@@ -9,10 +9,5 @@ module IncidentManagement
track_usage_event(:"incident_management_#{action}", current_user.id)
end
# No-op as optionally overridden in implementing classes.
# For use to provide checks before calling #track_incident_action.
def track_event
end
end
end
......@@ -2,8 +2,6 @@
module IssuableLinks
class CreateService < BaseService
include IncidentManagement::UsageData
attr_reader :issuable, :current_user, :params
def initialize(issuable, user, params)
......@@ -142,6 +140,10 @@ module IssuableLinks
def set_link_type(_link)
# no-op
end
def track_event
# no-op
end
end
end
......
......@@ -2,8 +2,6 @@
module IssuableLinks
class DestroyService < BaseService
include IncidentManagement::UsageData
attr_reader :link, :current_user, :source, :target
def initialize(link, user)
......@@ -41,5 +39,9 @@ module IssuableLinks
def not_found_message
'No Issue Link found'
end
def track_event
# no op
end
end
end
......@@ -2,6 +2,8 @@
module IssueLinks
class CreateService < IssuableLinks::CreateService
include IncidentManagement::UsageData
def linkable_issuables(issues)
@linkable_issuables ||= begin
issues.select { |issue| can?(current_user, :admin_issue_link, issue) }
......
......@@ -2,6 +2,8 @@
module IssueLinks
class DestroyService < IssuableLinks::DestroyService
include IncidentManagement::UsageData
private
def permission_to_remove_relation?
......
......@@ -111,7 +111,7 @@ module Notes
def track_event(note, user)
track_note_creation_usage_for_issues(note) if note.for_issue?
track_note_creation_usage_for_merge_requests(note) if note.for_merge_request?
track_usage_event(:incident_management_incident_comment, user.id) if note.for_issue? && note.noteable.incident?
track_incident_action(user, note.noteable, 'incident_comment') if note.for_issue?
if Feature.enabled?(:notes_create_service_tracking, project)
Gitlab::Tracking.event('Notes::CreateService', 'execute', **tracking_data_for(note))
......
......@@ -18,10 +18,9 @@ module EpicIssues
super
Epics::UpdateDatesService.new([link.epic]).execute
track_usage_ping_event
end
def track_usage_ping_event
def track_event
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_issue_removed(author: current_user)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment