diff options
author | Starfall <us@starfall.systems> | 2020-11-19 10:02:56 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2020-11-19 10:02:56 -0600 |
commit | 383bb3804bdbd6caa442283cc96ef0cdbfdb4575 (patch) | |
tree | 54ecc09c325567ab1cfc4af9ba13ad134d9c3c72 /app/services/delete_account_service.rb | |
parent | 259470ec37dfc5c3d34ed5456adcd3ab1a622a18 (diff) | |
parent | db01f8b942b72eaa2eacbb144261b002f8079c9c (diff) |
Merge branch 'glitch' into main
Diffstat (limited to 'app/services/delete_account_service.rb')
-rw-r--r-- | app/services/delete_account_service.rb | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index 15bdd13e3..de6488c78 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -64,8 +64,15 @@ class DeleteAccountService < BaseService def reject_follows! return if @account.local? || !@account.activitypub? + # When deleting a remote account, the account obviously doesn't + # actually become deleted on its origin server, i.e. unlike a + # locally deleted account it continues to have access to its home + # feed and other content. To prevent it from being able to continue + # to access toots it would receive because it follows local accounts, + # we have to force it to unfollow them. + ActivityPub::DeliveryWorker.push_bulk(Follow.where(account: @account)) do |follow| - [build_reject_json(follow), follow.target_account_id, follow.account.inbox_url] + [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] end end @@ -114,19 +121,20 @@ class DeleteAccountService < BaseService return unless @options[:reserve_username] - @account.silenced_at = nil - @account.suspended_at = @options[:suspended_at] || Time.now.utc - @account.locked = false - @account.memorial = false - @account.discoverable = false - @account.display_name = '' - @account.note = '' - @account.fields = [] - @account.statuses_count = 0 - @account.followers_count = 0 - @account.following_count = 0 - @account.moved_to_account = nil - @account.trust_level = :untrusted + @account.silenced_at = nil + @account.suspended_at = @options[:suspended_at] || Time.now.utc + @account.suspension_origin = :local + @account.locked = false + @account.memorial = false + @account.discoverable = false + @account.display_name = '' + @account.note = '' + @account.fields = [] + @account.statuses_count = 0 + @account.followers_count = 0 + @account.following_count = 0 + @account.moved_to_account = nil + @account.trust_level = :untrusted @account.avatar.destroy @account.header.destroy @account.save! @@ -154,10 +162,6 @@ class DeleteAccountService < BaseService @delete_actor_json ||= Oj.dump(serialize_payload(@account, ActivityPub::DeleteActorSerializer, signer: @account)) end - def build_reject_json(follow) - Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)) - end - def delivery_inboxes @delivery_inboxes ||= @account.followers.inboxes + Relay.enabled.pluck(:inbox_url) end |