diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-03-03 21:13:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-03 21:13:55 +0100 |
commit | 050f1669c6fc02d7a917261d16d9264512955bc6 (patch) | |
tree | f354e83bb34dc4819d4b9926069a603571e59c77 /app/workers/activitypub | |
parent | ddde4e0d954fbb1338774d61f1130e4af6924496 (diff) |
Fix original account being unfollowed on migration before the follow request could be sent (#21957)
Diffstat (limited to 'app/workers/activitypub')
-rw-r--r-- | app/workers/activitypub/migrated_follow_delivery_worker.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/workers/activitypub/migrated_follow_delivery_worker.rb b/app/workers/activitypub/migrated_follow_delivery_worker.rb new file mode 100644 index 000000000..17a9e515e --- /dev/null +++ b/app/workers/activitypub/migrated_follow_delivery_worker.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ActivityPub::MigratedFollowDeliveryWorker < ActivityPub::DeliveryWorker + def perform(json, source_account_id, inbox_url, old_target_account_id, options = {}) + super(json, source_account_id, inbox_url, options) + unfollow_old_account!(old_target_account_id) + end + + private + + def unfollow_old_account!(old_target_account_id) + old_target_account = Account.find(old_target_account_id) + UnfollowService.new.call(@source_account, old_target_account, skip_unmerge: true) + rescue StandardError + true + end +end |