mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 15:42:34 +01:00
Undo outgoing follows when suspending a remote account (#15188)
This commit is contained in:
parent
c43f4cd3bb
commit
66832cbf33
1 changed files with 15 additions and 0 deletions
|
@ -56,6 +56,7 @@ class DeleteAccountService < BaseService
|
||||||
@options[:skip_activitypub] = true if @options[:skip_side_effects]
|
@options[:skip_activitypub] = true if @options[:skip_side_effects]
|
||||||
|
|
||||||
reject_follows!
|
reject_follows!
|
||||||
|
undo_follows!
|
||||||
purge_user!
|
purge_user!
|
||||||
purge_profile!
|
purge_profile!
|
||||||
purge_content!
|
purge_content!
|
||||||
|
@ -79,6 +80,20 @@ class DeleteAccountService < BaseService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def undo_follows!
|
||||||
|
return if @account.local? || !@account.activitypub? || @options[:skip_activitypub]
|
||||||
|
|
||||||
|
# When deleting a remote account, the account obviously doesn't
|
||||||
|
# actually become deleted on its origin server, but following relationships
|
||||||
|
# are severed on our end. Therefore, make the remote server aware that the
|
||||||
|
# follow relationships are severed to avoid confusion and potential issues
|
||||||
|
# if the remote account gets un-suspended.
|
||||||
|
|
||||||
|
ActivityPub::DeliveryWorker.push_bulk(Follow.where(target_account: @account)) do |follow|
|
||||||
|
[Oj.dump(serialize_payload(follow, ActivityPub::UndoFollowSerializer)), follow.account_id, @account.inbox_url]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def purge_user!
|
def purge_user!
|
||||||
return if !@account.local? || @account.user.nil?
|
return if !@account.local? || @account.user.nil?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue