Improve collection item verification (#39096)
This commit is contained in:
1 parent
f28715d370
commit
22203f8aeb
4 files changed
+51
-5
No files matched your search
@@ -40,6 +40,17 @@ RSpec.describe ActivityPub::ProcessFeaturedItemService do
|
||||
end.to_not change(CollectionItem, :count)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the actor URI does not match the approval URI' do
|
||||
let(:featured_object_uri) { 'https://example.com/actor/1' }
|
||||
let(:feature_authorization_uri) { 'https://other.example.com/auth/1' }
|
||||
|
||||
it 'does not create a collection item and returns `nil`' do
|
||||
expect do
|
||||
expect(subject.call(collection, object, position:)).to be_nil
|
||||
end.to_not change(CollectionItem, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the collection item is inlined' do
|
||||
|
||||
@@ -85,4 +85,25 @@ RSpec.describe ActivityPub::VerifyFeaturedItemService do
|
||||
expect(collection_item).to be_rejected
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the authorization references a different account' do
|
||||
let(:verification_json) do
|
||||
{
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'type' => 'FeatureAuthorization',
|
||||
'id' => approval_uri,
|
||||
'interactionTarget' => 'https://example.com/actor/2',
|
||||
'interactingObject' => collection.uri,
|
||||
}
|
||||
end
|
||||
|
||||
before { featured_account }
|
||||
|
||||
it 'does not verify the item' do
|
||||
subject.call(collection_item, approval_uri)
|
||||
|
||||
expect(collection_item.account_id).to be_nil
|
||||
expect(collection_item).to be_pending
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user