migrated_follow_delivery_worker.rb 558 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. class ActivityPub::MigratedFollowDeliveryWorker < ActivityPub::DeliveryWorker
  3. def perform(json, source_account_id, inbox_url, old_target_account_id, options = {})
  4. super(json, source_account_id, inbox_url, options)
  5. unfollow_old_account!(old_target_account_id)
  6. end
  7. private
  8. def unfollow_old_account!(old_target_account_id)
  9. old_target_account = Account.find(old_target_account_id)
  10. UnfollowService.new.call(@source_account, old_target_account, skip_unmerge: true)
  11. rescue StandardError
  12. true
  13. end
  14. end