debian-mirror-gitlab/app/services/notes/destroy_service.rb

29 lines
944 B
Ruby
Raw Normal View History

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?
2021-03-08 18:12:59 +05:30
track_note_removal_usage_for_merge_requests(note) if note.for_merge_request?
2021-01-29 00:20:46 +05:30
end
private
def track_note_removal_usage_for_issues(note)
2022-08-27 11:52:29 +05:30
Gitlab::UsageDataCounters::IssueActivityUniqueCounter.track_issue_comment_removed_action(author: note.author,
project: project)
2016-06-02 11:05:42 +05:30
end
2021-03-08 18:12:59 +05:30
def track_note_removal_usage_for_merge_requests(note)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_remove_comment_action(note: note)
end
2016-06-02 11:05:42 +05:30
end
end
2020-03-13 15:44:24 +05:30
2021-06-08 01:23:25 +05:30
Notes::DestroyService.prepend_mod_with('Notes::DestroyService')