2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
module Notes
|
2018-12-13 13:39:08 +05:30
|
|
|
class DestroyService < ::Notes::BaseService
|
2016-06-02 11:05:42 +05:30
|
|
|
def execute(note)
|
2018-03-17 18:26:18 +05:30
|
|
|
TodoService.new.destroy_target(note) do |note|
|
|
|
|
note.destroy
|
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
clear_noteable_diffs_cache(note)
|
2021-01-29 00:20:46 +05:30
|
|
|
track_note_removal_usage_for_issues(note) if note.for_issue?
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def track_note_removal_usage_for_issues(note)
|
|
|
|
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_comment_removed_action(author: note.author)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-03-09 13:42:32 +05:30
|
|
|
|
|
|
|
Notes::DestroyService.prepend_if_ee('EE::Notes::DestroyService')
|