Fix regression in FetchRemoteResourceService (#5217)
* Fix regression in FetchRemoteResourceService * Update specs to match interface changes made in #5114shrike
parent
32e8a87830
commit
2559d9166c
|
@ -45,7 +45,7 @@ class FetchAtomService < BaseService
|
||||||
elsif ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].include?(@response.mime_type)
|
elsif ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].include?(@response.mime_type)
|
||||||
json = body_to_json(@response.to_s)
|
json = body_to_json(@response.to_s)
|
||||||
if supported_context?(json) && json['type'] == 'Person' && json['inbox'].present?
|
if supported_context?(json) && json['type'] == 'Person' && json['inbox'].present?
|
||||||
[json['id'], { id: true }, :activitypub]
|
[json['id'], { prefetched_body: @response.to_s, id: true }, :activitypub]
|
||||||
else
|
else
|
||||||
@unsupported_activity = true
|
@unsupported_activity = true
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -33,7 +33,7 @@ class FetchRemoteResourceService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def body
|
def body
|
||||||
fetched_atom_feed.second
|
fetched_atom_feed.second[:prefetched_body]
|
||||||
end
|
end
|
||||||
|
|
||||||
def protocol
|
def protocol
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe FetchRemoteResourceService do
|
||||||
allow(FetchAtomService).to receive(:new).and_return service
|
allow(FetchAtomService).to receive(:new).and_return service
|
||||||
feed_url = 'http://feed-url'
|
feed_url = 'http://feed-url'
|
||||||
feed_content = '<feed>contents</feed>'
|
feed_content = '<feed>contents</feed>'
|
||||||
allow(service).to receive(:call).with(url).and_return([feed_url, feed_content])
|
allow(service).to receive(:call).with(url).and_return([feed_url, { prefetched_body: feed_content }])
|
||||||
|
|
||||||
account_service = double
|
account_service = double
|
||||||
allow(FetchRemoteAccountService).to receive(:new).and_return(account_service)
|
allow(FetchRemoteAccountService).to receive(:new).and_return(account_service)
|
||||||
|
@ -39,7 +39,7 @@ describe FetchRemoteResourceService do
|
||||||
allow(FetchAtomService).to receive(:new).and_return service
|
allow(FetchAtomService).to receive(:new).and_return service
|
||||||
feed_url = 'http://feed-url'
|
feed_url = 'http://feed-url'
|
||||||
feed_content = '<entry>contents</entry>'
|
feed_content = '<entry>contents</entry>'
|
||||||
allow(service).to receive(:call).with(url).and_return([feed_url, feed_content])
|
allow(service).to receive(:call).with(url).and_return([feed_url, { prefetched_body: feed_content }])
|
||||||
|
|
||||||
account_service = double
|
account_service = double
|
||||||
allow(FetchRemoteStatusService).to receive(:new).and_return(account_service)
|
allow(FetchRemoteStatusService).to receive(:new).and_return(account_service)
|
||||||
|
|
Loading…
Reference in New Issue