update_distribution_worker.rb 660 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. class ActivityPub::UpdateDistributionWorker < ActivityPub::RawDistributionWorker
  3. # Distribute an profile update to servers that might have a copy
  4. # of the account in question
  5. def perform(account_id, options = {})
  6. @options = options.with_indifferent_access
  7. @account = Account.find(account_id)
  8. distribute!
  9. rescue ActiveRecord::RecordNotFound
  10. true
  11. end
  12. protected
  13. def inboxes
  14. @inboxes ||= AccountReachFinder.new(@account).inboxes
  15. end
  16. def payload
  17. @payload ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account, sign_with: @options[:sign_with]))
  18. end
  19. end