1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-08 13:35:51 +00:00

Deploying from b5f6826a82 [SKIP CI]

This commit is contained in:
silverpill
2026-07-06 15:19:40 +00:00
parent 50100bfbfa
commit 788a312dc0
2 changed files with 15 additions and 8 deletions
+14 -7
View File
@@ -6,7 +6,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="How to make polls in [ActivityPub] network.">
<meta name="description" content="This FEP documents how Mastodon and other [ActivityPub] applications implement polls.">
@@ -721,10 +721,10 @@
</tbody>
</table>
<h2 id="summary">Summary<a class="headerlink" href="#summary" title="Permanent link">&para;</a></h2>
<p>How to make polls in <a href="https://www.w3.org/TR/activitypub/">ActivityPub</a> network.</p>
<p>This FEP documents how Mastodon and other <a href="https://www.w3.org/TR/activitypub/">ActivityPub</a> applications implement polls.</p>
<h2 id="history">History<a class="headerlink" href="#history" title="Permanent link">&para;</a></h2>
<p>Mastodon <a href="https://github.com/mastodon/mastodon/pull/10111">implemented</a> polls in 2019 (<a href="https://docs.joinmastodon.org/spec/activitypub/#Question">documentation</a>).</p>
<p>ActivityStreams specification provides <a href="https://www.w3.org/TR/activitystreams-vocabulary/#questions">recommendations</a> for representing questions, but these recommendations were found to be impractical and the de-facto standard differs from them.</p>
<p>Mastodon <a href="https://github.com/mastodon/mastodon/pull/10111">implemented</a> polls in 2019 (<a href="https://docs.joinmastodon.org/spec/activitypub/#Question">documentation</a>).</p>
<h2 id="requirements">Requirements<a class="headerlink" href="#requirements" title="Permanent link">&para;</a></h2>
<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <a href="https://tools.ietf.org/html/rfc2119.html">RFC-2119</a>.</p>
<h2 id="overview">Overview<a class="headerlink" href="#overview" title="Permanent link">&para;</a></h2>
@@ -757,7 +757,7 @@
</ul>
</li>
</ul>
<p>The <code>name</code> of a poll option MUST be unique within a poll. If the text contains <a href="https://codeberg.org/fediverse/fep/src/branch/main/fep/9098/fep-9098.md">custom emoji</a> microsyntax, the corresponding <code>Emoji</code> objects are added to the <code>tag</code> array of the <code>Question</code> object.</p>
<p>The <code>name</code> of a poll option MUST be unique within a poll. If the text contains <a href="https://codeberg.org/fediverse/fep/src/branch/main/fep/9098/fep-9098.md">custom emoji</a> microsyntax, the corresponding <code>Emoji</code> objects are added to the <code>tag</code> array of the <code>Question</code> object. The text MUST be escaped before it is included in HTML.</p>
<p><code>Question</code> objects MAY have an <code>endTime</code> property indicating the time when the poll ends. Some implementations use <code>closed</code> property instead of <code>endTime</code> or in addition to it (even if the poll is open). Consumers MUST process <code>closed</code> in the same way as <code>endTime</code>.</p>
<p><code>Question</code> objects SHOULD have an <code>updated</code> property.</p>
<p>Example:</p>
@@ -828,17 +828,24 @@
<li>The voter has a permission to vote (if the poll is not public).</li>
<li>The poll is still active (if <code>endTime</code> is specified).</li>
<li>The vote with the specified <code>id</code> is not already registered.</li>
<li>The vote with the specified <code>name</code> is not already registered (if multiple choices are not allowed).</li>
<li>The vote from the specified actor is not already registered (if multiple choices are not allowed).</li>
<li>The vote with the specified <code>name</code> is not already registered (if multiple choices are allowed).</li>
</ul>
<p>If any of these checks fails, the vote MUST be ignored.</p>
<p>Otherwise, the author of the poll updates the vote count for the specified poll option (the <code>totalItems</code> property of a corresponding <code>replies</code> collection). The value of the <code>updated</code> property is changed to the current date and time.</p>
<h3 id="publishing-results">Publishing results<a class="headerlink" href="#publishing-results" title="Permanent link">&para;</a></h3>
<p>When actor that published a poll receives a vote, it publishes an <code>Update</code> activity containing the <code>Question</code> object with updated results. This activity MUST be delivered to the audience of the poll and to every actor that voted in the poll.</p>
<p>When the actor that published a poll receives a vote, it publishes an <code>Update</code> activity containing the <code>Question</code> object with updated results. This activity MUST be immediately delivered to the actor that sent the vote. It SHOULD also be delivered to the audience of the poll and to every actor that voted in the poll. <a href="https://developer.mozilla.org/en-US/docs/Glossary/Debounce">Debouncing</a> MAY be applied.</p>
<h3 id="closing-a-poll">Closing a poll<a class="headerlink" href="#closing-a-poll" title="Permanent link">&para;</a></h3>
<p>A poll is considered to be closed once the date specified by the <code>endTime</code> property has been reached. Implementations MAY add the <code>closed</code> property to explicitly specify the date when the poll was closed.</p>
<h2 id="editing-options">Editing options<a class="headerlink" href="#editing-options" title="Permanent link">&para;</a></h2>
<p>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.</p>
<p>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 it:</p>
<ul>
<li>Empty the <code>replies</code> collection of every poll option.</li>
<li>Set the <code>votersCount</code> to <code>0</code> (if implemented).</li>
<li>Publish an <code>Update</code> activity.</li>
</ul>
<h2 id="future-work">Future work<a class="headerlink" href="#future-work" title="Permanent link">&para;</a></h2>
<p>In order to address poll voters correctly in <code>Update</code> activities, a collection of voters needs to be introduced. This collection could be attached to a <code>Question</code> object using the <code>voters</code> property.</p>
<p>The method of identifying votes described in this document is not reliable because a reply can look exactly like a vote. Alternative representations are being discussed (e.g. the <code>Respond</code> activity).</p>
<h2 id="json-schemas">JSON schemas<a class="headerlink" href="#json-schemas" title="Permanent link">&para;</a></h2>
<ul>
File diff suppressed because one or more lines are too long