Array of options for the poll. Each PollOption has:
Text of the option. Like a Note’s content, it can contain links and Custom Emojis.
Number of votes for this option.
The Polls Extension allows users to create and vote on polls.
This extension requires pub.versia:social@1, which defines Notes.
There is no question field: the question goes in the content of the Note itself.
pub.versia:pollsFields
Array of options for the poll. Each PollOption has:
Text of the option. Like a Note’s content, it can contain links and Custom Emojis.
Number of votes for this option.
Whether the poll allows multiple votes to be cast for different options.
RFC 3339 timestamp of when the poll ends and no more votes can be cast. If not present, the poll does not expire.
{
"id": "0341e147rp002",
"type": "pub.versia:social/Note",
"created_at": "2024-06-19T01:07:44Z",
"author": "versia.example:033nrcdtky006",
"category": "microblog",
"content": "<p>What is your favorite color?</p>",
// ...
"extensions": {
"pub.versia:polls": {
"options": [
{
"content": "Red",
"votes": 9
},
{
"content": "Blue",
"votes": 5
},
{
"content": "Green",
"votes": 0
}
],
"multiple_choice": false,
"expires_at": "2024-06-22T01:07:44Z"
}
},
"visibility": "public",
"is_sensitive": false,
"mentions": []
}
A Vote holds every option one user chose in one poll. A user has at most one Vote in each poll.
"pub.versia:polls/Vote"GET /.versia/v0.7/entities/pub.versia:polls/Vote/{id}Fields
MUST be pub.versia:polls/Vote.
Indexes of the options that the user voted for, in the options array of the poll. MUST hold at least one index, and MUST NOT hold the same index twice.
id string Requiredcreated_at RFC3339 Requiredupdated_at RFC3339 extensions Extensions Individual votes are private. Clients SHOULD NOT display who voted, only the number of votes for each option and the total number of votes cast.
A poll’s options hold numbers of votes, not voters, and a Vote can only be fetched by the instance of the poll’s author.
The instance of the poll’s author MUST NOT count a Vote that:
options, or the same index twice,multiple_choice,id from a Vote that the same user already has in the poll.Such a Vote MUST be rejected.
A user changes their choices by sending the Vote again with the same id and new options, and withdraws their vote with a Delete. After a Delete, the user can vote again with a new Vote. A change or Delete that arrives after the poll has closed leaves the numbers as they are.
A Vote’s target MUST NOT change, and a receiver MUST discard a version that changes it. Voting in another poll takes a new Vote.
A sender MUST deliver Votes to the author of the Note.
Only the instance of the Note’s author may fetch a Vote.
When a poll’s votes change, its Note is sent again, and MUST also be delivered to the users who voted.
This extension registers the following interaction types:
pub.versia:polls/vote, for voting on a Poll attached to a Note.