2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
class DeleteDiffFilesWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-11-08 19:23:39 +05:30
|
|
|
include ApplicationWorker
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
feature_category :source_code_management
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-11-08 19:23:39 +05:30
|
|
|
def perform(merge_request_diff_id)
|
|
|
|
merge_request_diff = MergeRequestDiff.find(merge_request_diff_id)
|
|
|
|
|
|
|
|
return if merge_request_diff.without_files?
|
|
|
|
|
|
|
|
MergeRequestDiff.transaction do
|
|
|
|
merge_request_diff.clean!
|
|
|
|
|
|
|
|
MergeRequestDiffFile
|
|
|
|
.where(merge_request_diff_id: merge_request_diff.id)
|
|
|
|
.delete_all
|
|
|
|
end
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|