Skip to content

Commit

Permalink
Purge status reactions on account delete
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEssem authored and jordemort committed Sep 3, 2024
1 parent 2549ee8 commit 9f63402
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/services/delete_account_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def purge_content!
purge_polls!
purge_generated_notifications!
purge_favourites!
purge_status_reactions!
purge_bookmarks!
purge_feeds!
purge_other_associations!
Expand Down Expand Up @@ -198,6 +199,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?
Expand Down

0 comments on commit 9f63402

Please sign in to comment.