0
0
Fork 0

Send one Delete of Actor in ActivityPub when account is suspended (#6172)

This commit is contained in:
Eugen Rochko 2018-01-04 14:40:49 +01:00 committed by GitHub
parent 3bee0996c5
commit 02ba03d6db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 37 deletions

View file

@ -22,6 +22,8 @@ class SuspendAccountService < BaseService
end
def purge_content!
ActivityPub::RawDistributionWorker.perform_async(delete_actor_json, @account.id) if @account.local?
@account.statuses.reorder(nil).find_in_batches do |statuses|
BatchedRemoveStatusService.new.call(statuses)
end
@ -54,4 +56,14 @@ class SuspendAccountService < BaseService
def destroy_all(association)
association.in_batches.destroy_all
end
def delete_actor_json
payload = ActiveModelSerializers::SerializableResource.new(
@account,
serializer: ActivityPub::DeleteActorSerializer,
adapter: ActivityPub::Adapter
).as_json
Oj.dump(ActivityPub::LinkedDataSignature.new(payload).sign!(@account))
end
end