Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote
This commit is contained in:
commit
9de0de7d65
66 changed files with 2420 additions and 1868 deletions
|
@ -21,7 +21,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: object_json,
|
||||
}.with_indifferent_access
|
||||
}.deep_stringify_keys
|
||||
end
|
||||
|
||||
let(:conversation_hash) do
|
||||
|
@ -113,7 +113,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: json,
|
||||
}.with_indifferent_access
|
||||
}.deep_stringify_keys
|
||||
end
|
||||
|
||||
before do
|
||||
|
@ -2474,7 +2474,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: Addressable::URI.new(scheme: 'bear', query_values: { t: token, u: object_json[:id] }).to_s,
|
||||
}.with_indifferent_access
|
||||
}.deep_stringify_keys
|
||||
end
|
||||
|
||||
let(:object_json) do
|
||||
|
|
|
@ -16,7 +16,7 @@ RSpec.describe ActivityPub::Parser::StatusParser do
|
|||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: object_json,
|
||||
}.with_indifferent_access
|
||||
}.deep_stringify_keys
|
||||
end
|
||||
|
||||
let(:object_json) do
|
||||
|
@ -49,6 +49,24 @@ RSpec.describe ActivityPub::Parser::StatusParser do
|
|||
)
|
||||
end
|
||||
|
||||
context 'when the likes collection is not inlined' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), 'post1'].join('/'),
|
||||
type: 'Note',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
content: 'bleh',
|
||||
published: 1.hour.ago.utc.iso8601,
|
||||
updated: 1.hour.ago.utc.iso8601,
|
||||
likes: 'https://example.com/collections/likes',
|
||||
}
|
||||
end
|
||||
|
||||
it 'does not raise an error' do
|
||||
expect { subject.favourites_count }.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
describe '#quote_policy' do
|
||||
subject do
|
||||
described_class
|
||||
|
|
|
@ -89,6 +89,37 @@ RSpec.describe ActivityPub::VerifyQuoteService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with a valid activity for a post that cannot be fetched but is passed as fetched_quoted_object' do
|
||||
let(:quoted_status) { nil }
|
||||
|
||||
let(:approval_interaction_target) { 'https://b.example.com/unknown-quoted' }
|
||||
let(:prefetched_object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
type: 'Note',
|
||||
id: 'https://b.example.com/unknown-quoted',
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(quoted_account),
|
||||
content: 'previously unknown post',
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
before do
|
||||
stub_request(:get, 'https://b.example.com/unknown-quoted')
|
||||
.to_return(status: 404)
|
||||
end
|
||||
|
||||
it 'updates the status' do
|
||||
expect { subject.call(quote, fetchable_quoted_uri: 'https://b.example.com/unknown-quoted', prefetched_quoted_object: prefetched_object) }
|
||||
.to change(quote, :state).to('accepted')
|
||||
|
||||
expect(a_request(:get, approval_uri))
|
||||
.to have_been_made.once
|
||||
|
||||
expect(quote.reload.quoted_status.content).to eq 'previously unknown post'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a valid activity for a post that cannot be fetched but is inlined' do
|
||||
let(:quoted_status) { nil }
|
||||
|
||||
|
@ -148,7 +179,7 @@ RSpec.describe ActivityPub::VerifyQuoteService do
|
|||
|
||||
context 'with a valid activity for already-fetched posts, with a pre-fetched approval' do
|
||||
it 'updates the status without fetching the activity' do
|
||||
expect { subject.call(quote, prefetched_body: Oj.dump(json)) }
|
||||
expect { subject.call(quote, prefetched_approval: Oj.dump(json)) }
|
||||
.to change(quote, :state).to('accepted')
|
||||
|
||||
expect(a_request(:get, approval_uri))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue