mirror of
https://codeberg.org/fediverse/fep.git
synced 2026-08-05 11:46:04 +00:00
FEP-9967: Update proposal (#646)
- Specified how custom emojis work. - Added note about poll option limits. - Clarified how `updated` is used. - Added `type: implementation` to front matter. - Added "Implementations" section. Reviewed-on: https://codeberg.org/fediverse/fep/pulls/646 Co-authored-by: silverpill <silverpill@firemail.cc> Co-committed-by: silverpill <silverpill@firemail.cc>
This commit is contained in:
+19
-7
@@ -1,6 +1,7 @@
|
||||
---
|
||||
slug: "9967"
|
||||
authors: silverpill <@silverpill@mitra.social>
|
||||
type: implementation
|
||||
status: DRAFT
|
||||
discussionsTo: https://socialhub.activitypub.rocks/t/fep-9967-polls/4885
|
||||
dateReceived: 2025-01-23
|
||||
@@ -39,10 +40,14 @@ The value of this property MUST be an array of objects representing poll options
|
||||
- `type`: the `Collection` string.
|
||||
- `totalItems`: the total number of votes for this poll option.
|
||||
|
||||
The `name` of a poll option MUST be unique within a poll.
|
||||
The `name` of a poll option MUST be unique within a poll. If the text contains custom emoji microsyntax, the corresponding `Emoji` objects are added to the `tag` array of the `Question` object.
|
||||
|
||||
The number of poll options is often limited, but the limit differs between implementations.
|
||||
|
||||
`Question` objects SHOULD also have an `endTime` property indicating the time when the poll ends. Polls without ending time are not widely supported. Some implementations use `closed` property instead of `endTime` or in addition to it (even if the poll is open). Consumers MUST process `closed` in the same way as `endTime`.
|
||||
|
||||
`Question` objects SHOULD have an `updated` property.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
@@ -54,6 +59,7 @@ Example:
|
||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"content": "<p>Question</p>",
|
||||
"endTime": "2024-07-17T18:18:17Z",
|
||||
"updated": "2024-07-16T20:53:05Z",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "Note",
|
||||
@@ -77,6 +83,8 @@ Example:
|
||||
|
||||
## Voting
|
||||
|
||||
### Vote object
|
||||
|
||||
A vote is represented by a `Note` object with the following structure:
|
||||
|
||||
- `id`: the ID of the vote.
|
||||
@@ -106,6 +114,8 @@ Example of a vote:
|
||||
}
|
||||
```
|
||||
|
||||
### Receiving a vote
|
||||
|
||||
The structure of a vote is very similar to a direct reply. It can be identified as a `Note` with `name` and `inReplyTo` properties, but without a `content` property.
|
||||
|
||||
>[!NOTE]
|
||||
@@ -115,23 +125,25 @@ Upon receving a vote, the author of the poll performs the following checks:
|
||||
|
||||
- The voter has a permission to vote (if the poll is not public).
|
||||
- The poll is still active (if `endTime` is specified).
|
||||
- The vote with a specified ID is not already registered.
|
||||
- The vote with a specified `name` is not already registered (if multiple choices are not allowed).
|
||||
- The vote with the specified `id` is not already registered.
|
||||
- The vote with the specified `name` is not already registered (if multiple choices are not allowed).
|
||||
|
||||
If any of these checks fails, the vote MUST be ignored.
|
||||
|
||||
Otherwise, the author of the poll updates the vote count for a specified poll option (the `totalItems` property of a corresponding `replies` collection).
|
||||
Otherwise, the author of the poll updates the vote count for the specified poll option (the `totalItems` property of a corresponding `replies` collection). The value of the `updated` property is changed to the current date and time.
|
||||
|
||||
## Publishing results
|
||||
### Publishing results
|
||||
|
||||
When actor that published a poll receives a vote, it publishes an `Update` activity containing the `Question` object with updated results. This activity MUST be delivered to the audience of the poll and to every actor that voted in the poll.
|
||||
|
||||
The embedded `Question` object MUST have an `updated` property.
|
||||
|
||||
## Editing options
|
||||
|
||||
The type of a poll (single choice / multiple choices) and its options might be changed at any time. In that case the author of the poll MUST reset the vote counts.
|
||||
|
||||
## Implementations
|
||||
|
||||
This document is based on implementations of polls in Mastodon and Pleroma.
|
||||
|
||||
## References
|
||||
|
||||
- Christine Lemmer Webber, Jessica Tallon, [ActivityPub][ActivityPub], 2018
|
||||
|
||||
Reference in New Issue
Block a user