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 committed Dec 2, 2024
1 parent 76d78f5 commit 7b20384
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 @@ -150,6 +150,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 @@ -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?
Expand Down

0 comments on commit 7b20384

Please sign in to comment.