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 ...@@ -9,10 +9,5 @@ module IncidentManagement
track_usage_event(:"incident_management_#{action}", current_user.id) track_usage_event(:"incident_management_#{action}", current_user.id)
end 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
end end
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module IssuableLinks module IssuableLinks
class CreateService < BaseService class CreateService < BaseService
include IncidentManagement::UsageData
attr_reader :issuable, :current_user, :params attr_reader :issuable, :current_user, :params
def initialize(issuable, user, params) def initialize(issuable, user, params)
...@@ -142,6 +140,10 @@ module IssuableLinks ...@@ -142,6 +140,10 @@ module IssuableLinks
def set_link_type(_link) def set_link_type(_link)
# no-op # no-op
end end
def track_event
# no-op
end
end end
end end
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module IssuableLinks module IssuableLinks
class DestroyService < BaseService class DestroyService < BaseService
include IncidentManagement::UsageData
attr_reader :link, :current_user, :source, :target attr_reader :link, :current_user, :source, :target
def initialize(link, user) def initialize(link, user)
...@@ -41,5 +39,9 @@ module IssuableLinks ...@@ -41,5 +39,9 @@ module IssuableLinks
def not_found_message def not_found_message
'No Issue Link found' 'No Issue Link found'
end end
def track_event
# no op
end
end end
end end
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module IssueLinks module IssueLinks
class CreateService < IssuableLinks::CreateService class CreateService < IssuableLinks::CreateService
include IncidentManagement::UsageData
def linkable_issuables(issues) def linkable_issuables(issues)
@linkable_issuables ||= begin @linkable_issuables ||= begin
issues.select { |issue| can?(current_user, :admin_issue_link, issue) } issues.select { |issue| can?(current_user, :admin_issue_link, issue) }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
module IssueLinks module IssueLinks
class DestroyService < IssuableLinks::DestroyService class DestroyService < IssuableLinks::DestroyService
include IncidentManagement::UsageData
private private
def permission_to_remove_relation? def permission_to_remove_relation?
......
...@@ -111,7 +111,7 @@ module Notes ...@@ -111,7 +111,7 @@ module Notes
def track_event(note, user) def track_event(note, user)
track_note_creation_usage_for_issues(note) if note.for_issue? 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_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) if Feature.enabled?(:notes_create_service_tracking, project)
Gitlab::Tracking.event('Notes::CreateService', 'execute', **tracking_data_for(note)) Gitlab::Tracking.event('Notes::CreateService', 'execute', **tracking_data_for(note))
......
...@@ -18,10 +18,9 @@ module EpicIssues ...@@ -18,10 +18,9 @@ module EpicIssues
super super
Epics::UpdateDatesService.new([link.epic]).execute Epics::UpdateDatesService.new([link.epic]).execute
track_usage_ping_event
end end
def track_usage_ping_event def track_event
::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_issue_removed(author: current_user) ::Gitlab::UsageDataCounters::EpicActivityUniqueCounter.track_epic_issue_removed(author: current_user)
end 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