The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
735 B

  1. # frozen_string_literal: true
  2. class MoveService < BaseService
  3. def call(migration)
  4. @migration = migration
  5. @source_account = migration.account
  6. @target_account = migration.target_account
  7. update_redirect!
  8. process_local_relationships!
  9. distribute_update!
  10. distribute_move!
  11. end
  12. private
  13. def update_redirect!
  14. @source_account.update!(moved_to_account: @target_account)
  15. end
  16. def process_local_relationships!
  17. MoveWorker.perform_async(@source_account.id, @target_account.id)
  18. end
  19. def distribute_update!
  20. ActivityPub::UpdateDistributionWorker.perform_async(@source_account.id)
  21. end
  22. def distribute_move!
  23. ActivityPub::MoveDistributionWorker.perform_async(@migration.id)
  24. end
  25. end