From 6ddf0432e71aea7c62f1ee7946da5538d2526a13 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 3 Dec 2018 01:32:08 +0100 Subject: Improve account suspension speed and completeness (#9290) - Some associations were missing from the clean-up - Some attributes were not reset on suspension - Skip federation and streaming deletes when purging a dead domain - Move account association definitions to concern --- app/services/batched_remove_status_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/services/batched_remove_status_service.rb') diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index 75d756495..2e61904fc 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -9,7 +9,9 @@ class BatchedRemoveStatusService < BaseService # Remove statuses from home feeds # Push delete events to streaming API for home feeds and public feeds # @param [Status] statuses A preferably batched array of statuses - def call(statuses) + # @param [Hash] options + # @option [Boolean] :skip_side_effects + def call(statuses, **options) statuses = Status.where(id: statuses.map(&:id)).includes(:account, :stream_entry).flat_map { |status| [status] + status.reblogs.includes(:account, :stream_entry).to_a } @mentions = statuses.each_with_object({}) { |s, h| h[s.id] = s.active_mentions.includes(:account).to_a } @@ -26,6 +28,8 @@ class BatchedRemoveStatusService < BaseService status.destroy end + return if options[:skip_side_effects] + # Batch by source account statuses.group_by(&:account_id).each_value do |account_statuses| account = account_statuses.first.account -- cgit