Improve suspend account service

lolsob-rspec
Eugen Rochko 2016-12-06 18:32:36 +01:00
parent 88218c83d5
commit 51e60135ed
2 changed files with 8 additions and 5 deletions

View File

@ -11,11 +11,11 @@ class RemoveStatusService < BaseService
status.destroy! status.destroy!
if status.account.local? return unless status.account.local?
HubPingWorker.perform_async(status.account.id) HubPingWorker.perform_async(status.account.id)
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
end end
end
private private

View File

@ -12,8 +12,11 @@ class SuspendAccountService < BaseService
private private
def purge_content def purge_content
@account.statuses.find_each do |status|
RemoveStatusService.new.call(status)
end
@account.media_attachments.destroy_all @account.media_attachments.destroy_all
@account.statuses.destroy_all
@account.stream_entries.destroy_all @account.stream_entries.destroy_all
@account.mentions.destroy_all @account.mentions.destroy_all
@account.notifications.destroy_all @account.notifications.destroy_all