0
0
Fork 0

Use likes and shares totalItems on status creations and updates (#32620)

This commit is contained in:
Jonny Saunders 2024-10-27 21:55:18 -07:00 committed by GitHub
parent 77cd16f4ee
commit 9074c1fac9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 326 additions and 14 deletions

View file

@ -928,6 +928,32 @@ RSpec.describe ActivityPub::Activity::Create do
expect(poll.votes.first).to be_nil
end
end
context 'with counts' do
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
likes: {
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar', '/likes'].join,
type: 'Collection',
totalItems: 50,
},
shares: {
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar', '/shares'].join,
type: 'Collection',
totalItems: 100,
},
}
end
it 'uses the counts from the created object' do
status = sender.statuses.first
expect(status.untrusted_favourites_count).to eq 50
expect(status.untrusted_reblogs_count).to eq 100
end
end
end
context 'when object URI uses bearcaps' do