mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit '0ef43a431d353a17419ea6664ed745b5dbfbf2f9' into glitch-soc/merge-upstream
This commit is contained in:
@@ -731,6 +731,30 @@ RSpec.describe ActivityPub::Activity::Create do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with tagged Featured Collections' do
|
||||
let(:featured_collection) { Fabricate(:collection) }
|
||||
|
||||
let(:object_json) do
|
||||
build_object(
|
||||
tag: [
|
||||
{
|
||||
type: 'FeaturedCollection',
|
||||
id: ActivityPub::TagManager.instance.uri_for(featured_collection),
|
||||
},
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates the status with appropriate tagged objects' do
|
||||
expect { subject.perform }
|
||||
.to change(sender.statuses, :count).by(1)
|
||||
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status.tagged_objects.map(&:object)).to contain_exactly(featured_collection)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with hashtags' do
|
||||
let(:object_json) do
|
||||
build_object(
|
||||
|
||||
@@ -256,5 +256,45 @@ RSpec.describe ActivityPub::Activity::Update do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a `FeaturedCollection` object', feature: :collections_federation do
|
||||
let(:collection) { Fabricate(:remote_collection, account: sender, name: 'old name', discoverable: false) }
|
||||
let(:featured_collection_json) do
|
||||
{
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'id' => collection.uri,
|
||||
'type' => 'FeaturedCollection',
|
||||
'attributedTo' => sender.uri,
|
||||
'name' => 'Cool people',
|
||||
'summary' => 'People you should follow.',
|
||||
'totalItems' => 0,
|
||||
'sensitive' => false,
|
||||
'discoverable' => true,
|
||||
'published' => '2026-03-09T15:19:25Z',
|
||||
'updated' => Time.zone.now.iso8601,
|
||||
}
|
||||
end
|
||||
let(:json) do
|
||||
{
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'type' => 'Update',
|
||||
'actor' => sender.uri,
|
||||
'object' => featured_collection_json,
|
||||
}
|
||||
end
|
||||
let(:stubbed_service) do
|
||||
instance_double(ActivityPub::ProcessFeaturedCollectionService, call: true)
|
||||
end
|
||||
|
||||
before do
|
||||
allow(ActivityPub::ProcessFeaturedCollectionService).to receive(:new).and_return(stubbed_service)
|
||||
end
|
||||
|
||||
it 'updates the collection' do
|
||||
subject.perform
|
||||
|
||||
expect(stubbed_service).to have_received(:call).with(sender, featured_collection_json)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -671,5 +671,15 @@ RSpec.describe ActivityPub::TagManager do
|
||||
status = Fabricate(:status, uri: 'https://example.com/123')
|
||||
expect(subject.uri_to_resource('https://example.com/123#456', Status)).to eq status
|
||||
end
|
||||
|
||||
it 'returns the local featured collection' do
|
||||
collection = Fabricate(:collection)
|
||||
expect(subject.uri_to_resource(subject.uri_for(collection), Collection)).to eq collection
|
||||
end
|
||||
|
||||
it 'returns the remote featured collection' do
|
||||
collection = Fabricate(:remote_collection)
|
||||
expect(subject.uri_to_resource(subject.uri_for(collection), Collection)).to eq collection
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user