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:
parent
7a25bb858a
commit
833ffce2df
6 changed files with 33 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue