0
0
Fork 0

Store remote votes URI (#10158)

* Store remote votes URI

* Add spec for accepting remote votes

* Make poll vote id generation work the same way as follows
This commit is contained in:
ThibG 2019-03-04 22:51:23 +01:00 committed by Eugen Rochko
parent 7a25bb858a
commit 833ffce2df
6 changed files with 33 additions and 3 deletions

View file

@ -447,6 +447,27 @@ RSpec.describe ActivityPub::Activity::Create do
expect(poll.cached_tallies).to eq [10, 3]
end
end
context 'when a vote to a local poll' do
let(:poll) { Fabricate(:poll, options: %w(Yellow Blue)) }
let!(:local_status) { Fabricate(:status, owned_poll: poll) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
name: 'Yellow',
inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
}
end
it 'adds a vote to the poll with correct uri' do
vote = poll.votes.first
expect(vote).to_not be_nil
expect(vote.uri).to eq object_json[:id]
expect(poll.reload.cached_tallies).to eq [1, 0]
end
end
end
context 'when sender is followed by local users' do