Merge branch 'master' into glitch-soc/merge-upstream

This commit is contained in:
Thibaut Girka
2019-03-10 16:48:44 +01:00
6 changed files with 79 additions and 13 deletions

View File

@@ -41,6 +41,7 @@ class SuspendAccountService < BaseService
@account = account
@options = options
reject_follows!
purge_user!
purge_profile!
purge_content!
@@ -48,6 +49,14 @@ class SuspendAccountService < BaseService
private
def reject_follows!
return if @account.local? || !@account.activitypub?
ActivityPub::DeliveryWorker.push_bulk(Follow.where(account: @account)) do |follow|
[build_reject_json(follow), follow.target_account_id, follow.account.inbox_url]
end
end
def purge_user!
return if !@account.local? || @account.user.nil?
@@ -120,6 +129,14 @@ class SuspendAccountService < BaseService
@delete_actor_json = Oj.dump(ActivityPub::LinkedDataSignature.new(payload).sign!(@account))
end
def build_reject_json(follow)
ActiveModelSerializers::SerializableResource.new(
follow,
serializer: ActivityPub::RejectFollowSerializer,
adapter: ActivityPub::Adapter
).to_json
end
def delivery_inboxes
@delivery_inboxes ||= @account.followers.inboxes + Relay.enabled.pluck(:inbox_url)
end