diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 7d06302af5ae88..2399ab9886b25d 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -150,6 +150,7 @@ def purge_content! purge_polls! purge_generated_notifications! purge_favourites! + purge_status_reactions! purge_bookmarks! purge_feeds! purge_other_associations! @@ -197,6 +198,15 @@ def purge_favourites! end end + def purge_status_reactions! + @account.status_reactions.in_batches do |status_reactions| + ids = status_reactions.pluck(:status_id) + Chewy.strategy.current.update(StatusesIndex, ids) if Chewy.enabled? + Rails.cache.delete_multi(ids.map { |id| "statuses/#{id}" }) + status_reactions.delete_all + end + end + def purge_bookmarks! @account.bookmarks.in_batches do |bookmarks| Chewy.strategy.current.update(StatusesIndex, bookmarks.pluck(:status_id)) if Chewy.enabled?