about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-11-25 15:31:45 +0100
committerThibaut Girka <thib@sitedethib.com>2020-11-25 15:31:45 +0100
commite71b16ae2b5623dc664c79ffa7d96282af662c78 (patch)
treedb77dc96f03d7e9b51e33b379dd1f1b9bebc0343 /app/services
parent24696458bf22c8529b49f89b2791e3e07583b7e0 (diff)
parent41b38b027396d50cac2cf995f2b5830c2cf592fa (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `Gemfile.lock`:
  glitch-soc-only dependency textually too close to updated upstream
  dependencies. Updated to upsteam dependencies.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/delete_account_service.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb
index 778d064de..9cb80c95a 100644
--- a/app/services/delete_account_service.rb
+++ b/app/services/delete_account_service.rb
@@ -56,6 +56,7 @@ class DeleteAccountService < BaseService
     @options[:skip_activitypub] = true if @options[:skip_side_effects]
 
     reject_follows!
+    undo_follows!
     purge_user!
     purge_profile!
     purge_content!
@@ -79,6 +80,20 @@ class DeleteAccountService < BaseService
     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!
     return if !@account.local? || @account.user.nil?