~cytrogen/masto-fe

ref: 27e84c069112a3d2abfad947642457cc997a261a masto-fe/app/services/activitypub/fetch_remote_account_service.rb -rw-r--r-- 588 bytes
27e84c06 — Claire Fix duplicate reports being sent when reporting some remote posts (#27355) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

class ActivityPub::FetchRemoteAccountService < ActivityPub::FetchRemoteActorService
  # Does a WebFinger roundtrip on each call, unless `only_key` is true
  def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false, suppress_errors: true, request_id: nil)
    actor = super
    return actor if actor.nil? || actor.is_a?(Account)

    Rails.logger.debug { "Fetching account #{uri} failed: Expected Account, got #{actor.class.name}" }
    raise Error, "Expected Account, got #{actor.class.name}" unless suppress_errors
  end
end