FEP-9967: Polls
Link: fep/fep/9967/fep-9967.md at main - fediverse/fep - Codeberg.org
Summary
How to make polls in ActivityPub network.
Link: fep/fep/9967/fep-9967.md at main - fediverse/fep - Codeberg.org
How to make polls in ActivityPub network.
Even though this is as implemented today, I think we’d be amiss not to document how this should ideally be done. And how we can evolve today’s implementations towards that.
E.g., a Vote activity and using Question activities, still allowing for replies via Notes as comments on the poll.
e.g., what’s the behavior if someone sends a:
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://social.example/votes/1",
"type": "Note",
"attributedTo": "https://social.example/actors/2",
"inReplyTo": "https://social.example/polls/1",
"name": "Answer 1",
"content": "Some text explaining my vote",
"attachments": [
...
]
"to": "https://social.example/actors/1"
}
In today’s implementations? I suspect the content
would be dropped and only the vote counted?
I think the decision to use Question
as an object was a reasonable one, and that the spec should be amended to reflect this practice. But voting with Create(Note)
is not ideal, and I agree with you that Vote
activity would be better. In the Pleroma issue someone mentioned the Answer
type, which was (?) discussed by the working group but not included in the final vocabulary; I need to dig into the archives to figure out why.
Don’t know about others, but my implementation treats this as a reply with “direct” visibility
Yeah, I think you’ve like Question/Answer for like asks or q&a sites, and then Create(Question) / Vote for polls?
Ha, I guess that deanonymizes votes to the poll creator, where as typically they don’t know who voted for what.
I like Question/Answer for both. A vote is an answer to the poll’s question. I understand we’re discussing “polls” in a Mastodon implementation context, but in general, a poll is not necessarily a vote for a single set of mutually-exclusive options.
Just curious… do you know if Answer
is an activity (verb) or non-activity object (noun)? Question and Answer are interesting because, semantically, they can be both a noun and a verb.
My reading of that section is that Question was intended not primarily as polls, but I haven’t done the full spec archaeology on that one. Open-ended ask-style questions are more likely the primary intention. The confusing bit is that oneOf/anyOf exist not as options but instead as hints on how you might respond. In other words, there is no mechanism to actually force you to stick to those options. The whole concept seems half-baked because “polls” can be a lot more complex than open-ended questions, and they have significantly different considerations. I feel like there is another parallel issue with AS2-Vocab which is that sometimes, terms get used with different meanings just because the English word is close enough to the intention. Think of why Question is an Activity at all, and it’s pretty clear that the main motivation is to be able to use result
. But the “result” of an action is not necessarily the same as the “result” of a poll. It’s also not immediately clear what either of those senses mean…
Somewhat luckily, that section is non-normative and honestly could be removed entirely without making a difference. I don’t think it makes for good guidance, but more generally, this is the kind of stuff that makes for better input into semantic profiles (e.g. some way to signal adherence to a poll protocol, where a certain shape must be satisfied and certain behavior might be expected)
I didn’t find any info about the Answer
, but there is wiki page (last edited in 2015) that recommends PossibleAnswer
for poll options and Respond
for votes:
https://www.w3.org/wiki/Activity_Streams/Expanded_Vocabulary#Questions
Respond
is an activity.
I like the name Respond
. Added a note about it to the FEP and removed the mention of multi-object Create
which AFAIK is not used in the wild: #479 - FEP-9967: Update proposal - fediverse/fep - Codeberg.org
In other news, an issue about testing poll limits has been created at fediverse-pasture-inputs.
Answer
is something I just made up. My thinking being that it’d be an Activity? e.g., you could answer with a Note, an Image, a Video, etc.
Where as Vote
is more an explicit intent than just a reply that may be an answer. e.g., Someone could do:
Actor1: Question(Note) -> questionId
Actor2: Answer(Note, questionId) -> answer
Actor1: Accept(answer)
Or something to have a "the person asking a question has marked an answer as accepted, and it should be given priority over other answers / replies.
Since Question
is an IntransitiveActivity
and therefore doesn’t have an object
, is the Note
the type of the objects in oneOf
or anyOf
? I assume it could alternatively be any other Object type (Image, Video, Place) or even a combination. As an example, for a question “Which of these represents our organization the best?”, with the answer set having a combination of Note
(text), Image
, Video
, Audio
objects.
Several minor additions and edits (custom emojis, updated
attribute): #646 - FEP-9967: Update proposal - fediverse/fep - Codeberg.org
The question is to what extent current app focus should influence the future of the fediverse, as ever more of “The Mastodon Way” becomes the reality on the wire via post-facto interoperability. On a “Dating app” issue in W3C ActivityPub repo I commented that SocialCG should focus primarily on “bringing new interoperable services to the fediverse” instead of “federate a new type of app”.
AS/AP has an extension mechanism based on Linked Data, and a best-practice for modeling LD is to build with existing ontologies if possibly, preferably well-known ones. One can say a Poll is a type of Survey, and then there’s https://w3id.org/survey-ontology (an ontology created with EU Horizons funding by ACTION project) ..
Note that this is just the first search result in DDG and this survey model specifically extends Research Object Suite of Ontologies i.e. has an Open Science context (but in their presentation they call it “a generic and comprehensive open vocabulary to describe any kind of survey”). A different ontology is “An Ontology for Surveys” (PDF) by Mark S. Fox and Megan Katsumi.
My main question is should we be bolting together fediverse Poll/Survey support in piecemeal FEP increments whenever an app adds a new feature or variation of one, organic growth style what-comes-that-comes? Or is it more prudent and beneficial to have a richer domain model be the focal point for delivering interoperable services within our ecosystem?
@andre just tooted the following:
While developing the initial version of the #polls for #ActivityPub #WordPress plugin, I so often got reminded to the preamble words of @gancio from @lesion
“Building software means taking a stand, making decisions, choices. These choices start from a precise look at reality, from specific needs and ends implementing specific features, choose default values, simplify some flow and patterns while making difficult others.”
It’s just a tiny poll plugin, but there are still decisions to be made: For example, when to reveal the poll vote counts, to whom, and when to reset the vote counts (e.g. when changing the type from single choice to multiple).
There are many flow patterns that I don’t consider worth striving for. Please help me by leaving some comments on the scenarios you can imagine.
For example Mastodon always extends the expiration date when editing a poll, even if the poll has already ended. Is this scenario of extending a poll as long as it suits the poll creator anything I should worry about?
Another example: Mastodon allows you to reveal results of a poll by another person. Immediately after you did that, I does not allow you to vote, but on page reload you may.
Should one be allowed to vote on own polls?
How important is protecting anonymity of voters? Is not providing UI or APIs enough, or should it be almost impossible to get the voters choices from the database?
I wonder, one could hash the remote actors who replied, one could even salt that hash differently for each poll. But this would maybe make it harder in the future to prevent bad actors and spamming of polls.
For example, when to reveal the poll vote counts, to whom
This depends on the audience (to
/ cc
) of the Question
object. If the object is public, then the vote counts are public too.
when to reset the vote counts (e.g. when changing the type from single choice to multiple)
The FEP currently recommends a reset when poll type or options are changed: https://codeberg.org/fediverse/fep/src/branch/main/fep/9967/fep-9967.md#editing-options
Mastodon always extends the expiration date when editing a poll, even if the poll has already ended.
I think this is a bit weird, but in general - why not?
Mastodon allows you to reveal results of a poll by another person. Immediately after you did that, I does not allow you to vote, but on page reload you may.
Not allowing to vote sounds like a bug.
Should one be allowed to vote on own polls?
Absolutely
How important is protecting anonymity of voters?
The FEP currently says: "If the poll is anonymous, this [Create] activity MUST NOT be delivered to anyone else."
How votes are stored in the database is an implementation detail. Personally I prefer to keep a record of every vote.
cc @linos
It is quite common that votes are not disclosed when the poll is open, even the Mastodon API allows to do that. I think both cases are useful and neither one is bad as is.
How to store votes: when taking e.g. Mastodon as a reference only admins could check who voted, but on a platform like WordPress it is very likely, that the ratio of users who have access to the database is much higher, so it may be more important, at least not provide such a feature.
I think designing a UI to make the flow to first vote and then check results easier is a good thing. It is not about forbidding, it cannot be done, but it can be harder.
Having an end date which is more or less locked, at least after the poll is closed: I wonder if the freedom to do so is more important than the potential misuse. But I really don't know, I just have some doubts and obviously coding too much and don't see things so clearly today :)
@silverpill @aschrijver @feps I will file a review and my thoughts in detail in the issue tracker rafter my current milestone is finished, it should not take more than let's say two weeks until I can do so.