gitlab-org--gitlab-foss/app/services/notes/destroy_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
831 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-04-05 19:21:02 -04:00
module Notes
class DestroyService < ::Notes::BaseService
2016-04-05 19:21:02 -04:00
def execute(note)
TodoService.new.destroy_target(note) do |note|
note.destroy
end
clear_noteable_diffs_cache(note)
track_note_removal_usage_for_issues(note) if note.for_issue?
track_note_removal_usage_for_merge_requests(note) if note.for_merge_request?
end
private
def track_note_removal_usage_for_issues(note)
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_comment_removed_action(author: note.author)
2016-04-05 19:21:02 -04:00
end
def track_note_removal_usage_for_merge_requests(note)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_remove_comment_action(note: note)
end
2016-04-05 19:21:02 -04:00
end
end
Notes::DestroyService.prepend_mod_with('Notes::DestroyService')