fetch_remote_account_service.rb 588 B

123456789101112
  1. # frozen_string_literal: true
  2. class ActivityPub::FetchRemoteAccountService < ActivityPub::FetchRemoteActorService
  3. # Does a WebFinger roundtrip on each call, unless `only_key` is true
  4. def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false, suppress_errors: true, request_id: nil)
  5. actor = super
  6. return actor if actor.nil? || actor.is_a?(Account)
  7. Rails.logger.debug { "Fetching account #{uri} failed: Expected Account, got #{actor.class.name}" }
  8. raise Error, "Expected Account, got #{actor.class.name}" unless suppress_errors
  9. end
  10. end