Mastodon: Polls

Created on 12 Apr 2017  Â·  37Comments  Â·  Source: tootsuite/mastodon

On twitter, I have used polls to write an interactive story together with @blinry. This is currently not possible with Mastodon.

I would like to start working on this though I am not sure if I will be able to finish.




I searched or browsed the repo’s other issues to ensure this is not a duplicate:

screenshot

suggestion ui

Most helpful comment

what does this add that using an outside site like http://www.strawpoll.me/ doesn't?

It adds another way of interacting with followers without introducing a dependency to a third-party service.

All 37 comments

Any hints and suggestions on how to implement this – datastructure/protocol-wise – are welcome, I guess!


I made some mockups:

add-poll


poll-options


vote

My wishlist for this feature would be:

  • up to 6 options (because 6 is more than 4)
  • up to 30 characters per option (so that Die Toilettenpapierhalterungen fits in)

Later (second or third iteration):

  • make polls expire
  • let poll creator allow voting on multiple options
  • let poll creator allow adding own options

These are the database changes that I would make:

  • Add the following column to [statuses]:
t.string "poll_options", default: [], null: false, array: true
  • Create the following table:
create_table "poll_votes", force: :cascade do |t|
  t.bigint "status_id"
  t.string "poll_option", null: false
  t.integer  "account_id"
  t.datetime "created_at", null: false
  t.datetime "updated_at", null: false
  t.index ["status_id"], name: "index_poll_votes_on_status_id", using: :btree
end

These are the API changes that I would make:

  • Add poll_options to the [Status entity]
  • Adjust [endpoints for statuses] to respect poll_options
  • Provide new Poll entity (only GET endpoint) which contains:

    • The status ID

    • The number of votes per option (anonymously)

I'd like to have a very simple implementation for the first iteration so that the feature could be shipped fast. This includes:

  • Use boring radio buttons for voting.
  • Avoid logic for expiring polls automatically.
  • Don't allow poll options or votes to be edited later.
  • Don't allow adding a poll to an existing status.
  • Display results as numbers instead of bar charts. (getting bars drawn correctly on different screens isn't trivial)

As an alternative for expiring polls after a specified amount of time, we could introduce a Close poll button for the poll creator and a matching API endpoint.

Other than bringing over functionality that Twitter has right now, what does this add that using an outside site like http://www.strawpoll.me/ doesn't?

what does this add that using an outside site like http://www.strawpoll.me/ doesn't?

It adds another way of interacting with followers without introducing a dependency to a third-party service.

a strong tool for this is also an "end notification"

twitter allows it to have an expiring date, but it can be hard to scroll back and find your poll, if you are an active user

@wxcafe Thank you for labeling the issue! :+1:

Is there a way to get feedback on the ideas above from mastodon maintainers or should I just start working on it and submit a pull request? :smile:

This is a really nice feature, thanks for working on it! I fondly remember polls from my first social network at our university, this was before Facebook and Twitter existed. Polls are a fun and low-threshold way to engage a community and a good discussion starter.

One option I'd like to suggest is to make the poll anonymous vs non-anonymous. That is, in one case just show the percentages, and in the other case also show the names of who voted. I found anonymous polls good to get honest answers, and non-anonymous polls good for asking among friends, e.g. who wants to go watch which movie.

(Note in the anonymous case, the server would still know who voted how. It is highly nontrivial in a distributed system to make this truely anonymous. We would just hide the names - I think that is what you are doing right now anyway.)

And one question, (how) do you deal with remote accounts? Can they vote, too? Does Mastodon set a cookie if you interacted using a remote account, so that we can identify that you already voted and change the UI accordingly?

please keep in mind that gnu/social already has a polls feature that you may want to try to be compatible with :)

@hoodiek Having a "poll ended" notification would make Mastodon polls much better than Twitter polls. Do you think the notification should just go to the poster of the poll or should it also go to users who voted in it in case they want to see the final results?

This sounds awesome especially if you can choose to have it in ranked choice voting.

I had a quick look at the subject, and it seems polls have already been thought about in ActivityStreams: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-question
https://www.w3.org/TR/activitystreams-vocabulary/#questions

Announcing, closing and responding to polls seems pretty straightforward with those specifications. I am not too happy with how results (intermediate or final) can be synchronized across instances, however.

@ThibG Indeed, simple enough to make it work so the origin server has a working poll, and it's possible to forward poll answers to the author's followers just like replies, but if the poll is boosted or loaded somewhere else there's no simple way to guarantee it displays complete results...

That is, unless you literally hit the origin server to pull down the latest data on each load of the REST API response. And while that solves the latest-data problem, that's a loooooot of extra load on all servers suddenly.

I mean, making results click-to-play is probably not an unreasonable idea.

On Thu, Apr 19, 2018 at 10:22 AM Eugen Rochko notifications@github.com
wrote:

That is, unless you literally hit the origin server to pull down the
latest data on each load of the REST API response. And while that solves
the latest-data problem, that's a loooooot of extra load on all servers
suddenly.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tootsuite/mastodon/issues/1629#issuecomment-382755569,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAORV9MYnzXphZ903pjI-d0UtC4RrCppks5tqJ2egaJpZM4M7zR0
.

If loading the results was a separate, click-to-play endpoint, then that would be a bit more acceptable, yes. I suppose we don't really care if the origin server lies about the responses, do we? So we could save them in a flat structure without trying to verify/normalize into a relational schema.

We could also try to forward replies along the same path we forward deletes: taking boosts into account. Not sure how that would scale.
Worst case, we could just have a link “view results” that goes to the public status view, but that's suboptimal.

Forwarding will not be necessary in the scenario nightpool suggests. Although you can probably forget about real-time updating bars like on strawpoll, I think...

Another thing I dislike with the proposed handling of results is the lack of privacy. Ok sure, we don't have very strong privacy expectations for this kind of things, but still, why would every server need to know who has voted what?

In that case maybe you don't want polls, maybe you want to use Strawpoll... Either that or ActivityPub needs a way to display answer counts without listing individual answers. Tbh, imagine a typical poll on Twitter, it can get thousands of replies. There are hardly any threads with thousands of replies, so this is a unique leap, and a JSON document with thousands of

{
  "attributedTo": "http://sally.example.org",
  "inReplyTo": "http://polls.example.org/question/1",
  "name": "arduino"
}

is gonna weigh a lot of KB!

Oh yeah i was assuming remote servers would only ever see counts.

On Thu, Apr 19, 2018 at 10:56 AM Eugen Rochko notifications@github.com
wrote:

In that case maybe you don't want polls, maybe you want to use
Strawpoll... Either that or ActivityPub needs a way to display answer
counts without listing individual answers. Tbh, imagine a typical poll on
Twitter, it can get thousands of replies. There are hardly any threads with
thousands of replies, so this is a unique leap, and a JSON document with
thousands of

{
"attributedTo": "http://sally.example.org",
"inReplyTo": "http://polls.example.org/question/1",
"name": "arduino"
}

is gonna weigh a lot of KB!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tootsuite/mastodon/issues/1629#issuecomment-382767542,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAORV_O1k3ZFsCoXo2nRvaA7xP_RjxY1ks5tqKWFgaJpZM4M7zR0
.

@Gargron yes, that's also why I don't like that representation (though it's probably not that bad). Thankfully, “This section is non-normative”. I think the suggested ways of announcing a poll and replying to it are fine, but we may want to decide on something else to display the results (a list of counts associated with the different answers seems fine).

Maybe each answer that shows up in the poll could itself be an AS2 collection which can give its totalItems, but which can (optionally, if non-anonymous) also expose its items (which are the actual response objects) in case anyone wants to "audit" it or see what their friends said?

I wonder what @evanp thinks?

so the collection's name in this case would be the answer to the poll

I was recently perusing the docs for activity streams, and like @ThibG the Question activity type reminded me a lot of this old issue. Has the idea reached a stand still? (And how was Question activity meant to be used?)

So what is the progress after nearly two years? Let me make a brief conclusion:

  • Polls are necessary and simple, the problem is the federated part.
  • Although AS has a standard for polls (questions), it is impractical to implement it.
  • Problem 1: Should polls be treated like toots?
  • Consensus 1: No, it should be treated as an individual service (or else we need to consider the privacy part, re-boost part and more). As I see it, polls should be loaded as third-party content (like youtube videos), but you can interact with your Mastodon account.
  • Problem 2: How to sync poll data between different instances?
  • Consensus 2: If the poll is still active, it is impractical to load the real time result instantly (return result after you join the poll?). And if the poll is closed, it is impractical to load a long list of accounts (paginations?).
  • Problem 3: How to protect privacy in polls?
  • As far as I see, the user who call for a poll must specify the type (anonymous or public), voters(public means everyone, DM means invited users only, and so on) and expiration time for this vote.

Just my two cents ...

Problem 2: How to sync poll data between different instances?

Part of it could be, there is a little "reload" button that fetches the latest results from the originating instance when clicked. There's probably a more automated way but I thought I'd suggest it because why not?

Problem 3: How to protect privacy in polls?

All Twitter polls are "anonymous", by which I mean the average user can't tell who voted how. I've never seen anyone complain that you can't see how everyone voted, but I guess it does suck when a poll gets swamped with TERFs and it's not possible to separate well-meaning voters from bad-intentioned voters. That's probably a level of complexity that we don't really need though, Mastodon isn't a survey company. So I guess what I'm getting at is, I don't think we need non-anonymous polls.

Can the system store who has voted separately from counting how many votes for each option? So it knows how many people voted "blue", and if you try to vote again somehow it's like "no you've already voted", but it doesn't have to be like "no you've already voted and we can see that you've voted for blue"?

Can the system store who has voted separately from counting how many votes for each option? So it knows how many people voted "blue", and if you try to vote again somehow it's like "no you've already voted", but it doesn't have to be like "no you've already voted and we can see that you've voted for blue"?

That's easy to implement, but it may clash with the ActivityStreams standard and cause problems. For example, you can't retrieve your poll if you press the wrong option, since server can't verify it.

So I think anonymous polls are not necessary ... Maybe it should work in Twitter's way, storing all votes and voter's options, but not showing it up on interface.

For example, you can't retrieve your poll if you press the wrong option, since server can't verify it.

That's pretty much how it is on Twitter too! It is a little inconvenient, so I can see why maybe Mastodon would want to do better.

Anyway, thanks for explaining. :)

I think point 2 that @Cassolotl mentioned is the same click to play point @nightpool made...but I could be wrong.

Revisiting this issue, I think we can have Collections as options as @cwebber suggested.
When serializing the poll to AS, we would inline the totalItems but not the items themselves.
This would allow the numbers to be accurate whenever the poll is fetched.
If a remote poll does not have Collections as options, or the totalItems is not inlined, we could include a link “See results on the original server”
We need to handle Update to close polls.
Instead of forwarding replies (like we do for usual replies), we could simply send an Update with the appropriate collection(s), changing its totalItems.

the replies {items} should contain at minimum who voted, which question they were voting in reply to, and what their option was. changing your vote should be as simple as sending another Update with your new option (and attributedTo the same id)

@trwnh we may want to avoid returning replies for both efficiency and privacy reasons, that's why we were talking about using a Collection with totalItems.

I’m not sure if this is the proper discussion, but a feature polls should have is the ability to specify a closure time and (if a finite closure has been specified) the option to hide totals until the conclusion of voting.

Related, would it be a good idea to allow poll creators of polls with totals that can be viewed prior to casting a vote the option to disallow vote changes?

— Chris
On Feb 24, 2019, 7:38 AM -0500, ThibG notifications@github.com, wrote:

@trwnh we may want to avoid returning replies for both efficiency and privacy reasons, that's why we were talking about using a Collection with totalItems.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cumbiame picture cumbiame  Â·  3Comments

cwebber picture cwebber  Â·  3Comments

flukejones picture flukejones  Â·  3Comments

Lewiscowles1986 picture Lewiscowles1986  Â·  3Comments

hugogameiro picture hugogameiro  Â·  3Comments