|
|
@ -187,7 +187,7 @@ class DeleteAccountService < BaseService |
|
|
|
@account.favourites.in_batches do |favourites| |
|
|
|
@account.favourites.in_batches do |favourites| |
|
|
|
ids = favourites.pluck(:status_id) |
|
|
|
ids = favourites.pluck(:status_id) |
|
|
|
StatusStat.where(status_id: ids).update_all('favourites_count = GREATEST(0, favourites_count - 1)') |
|
|
|
StatusStat.where(status_id: ids).update_all('favourites_count = GREATEST(0, favourites_count - 1)') |
|
|
|
Chewy.strategy.current.update(StatusesIndex, ids) if Chewy.enabled? |
|
|
|
Chewy.strategy.current.update(StatusesIndex::Status, ids) if Chewy.enabled? |
|
|
|
# Rails.cache.delete_multi would be better, but we don't have it yet |
|
|
|
# Rails.cache.delete_multi would be better, but we don't have it yet |
|
|
|
ids.each { |id| Rails.cache.delete("statuses/#{id}") } |
|
|
|
ids.each { |id| Rails.cache.delete("statuses/#{id}") } |
|
|
|
favourites.delete_all |
|
|
|
favourites.delete_all |
|
|
@ -196,7 +196,7 @@ class DeleteAccountService < BaseService |
|
|
|
|
|
|
|
|
|
|
|
def purge_bookmarks! |
|
|
|
def purge_bookmarks! |
|
|
|
@account.bookmarks.in_batches do |bookmarks| |
|
|
|
@account.bookmarks.in_batches do |bookmarks| |
|
|
|
Chewy.strategy.current.update(StatusesIndex, bookmarks.pluck(:status_id)) if Chewy.enabled? |
|
|
|
Chewy.strategy.current.update(StatusesIndex::Status, bookmarks.pluck(:status_id)) if Chewy.enabled? |
|
|
|
bookmarks.delete_all |
|
|
|
bookmarks.delete_all |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|