Polls #1629

Open
winniehell opened this Issue Apr 12, 2017 · 27 comments

Comments

Projects
None yet
@winniehell

winniehell commented Apr 12, 2017

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
@blinry

This comment has been minimized.

Show comment
Hide comment
@blinry

blinry Apr 12, 2017

Contributor

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

Contributor

blinry commented Apr 12, 2017

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

@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 12, 2017

I made some mockups: add-poll
poll-options
vote
I made some mockups: add-poll
poll-options
vote
@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 12, 2017

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

winniehell commented Apr 12, 2017

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
@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 12, 2017

These are the database changes that I would make:

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

winniehell commented Apr 12, 2017

These are the database changes that I would make:

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
@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 12, 2017

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)

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)
@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 12, 2017

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.

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.

@mkosler

This comment has been minimized.

Show comment
Hide comment
@mkosler

mkosler Apr 13, 2017

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?

mkosler commented Apr 13, 2017

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?

@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 13, 2017

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.

winniehell commented Apr 13, 2017

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.

@wxcafe wxcafe changed the title from Feature request: Support polls to Polls Apr 13, 2017

@hoodiek

This comment has been minimized.

Show comment
Hide comment
@hoodiek

hoodiek Apr 14, 2017

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

hoodiek commented Apr 14, 2017

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

@winniehell

This comment has been minimized.

Show comment
Hide comment
@winniehell

winniehell Apr 17, 2017

@wxcafe Thank you for labeling the issue! 👍

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? 😄

@wxcafe Thank you for labeling the issue! 👍

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? 😄

winniehell added a commit to winniehell-forks/mastodon that referenced this issue Apr 20, 2017

@jdmansour

This comment has been minimized.

Show comment
Hide comment
@jdmansour

jdmansour May 29, 2017

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?

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?

@r14c

This comment has been minimized.

Show comment
Hide comment
@r14c

r14c Jun 21, 2017

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

r14c commented Jun 21, 2017

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

@duck57

This comment has been minimized.

Show comment
Hide comment
@duck57

duck57 Jul 10, 2017

@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?

duck57 commented Jul 10, 2017

@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?

@Starless-Night

This comment has been minimized.

Show comment
Hide comment
@Starless-Night

Starless-Night Jul 27, 2017

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

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

@ThibG

This comment has been minimized.

Show comment
Hide comment
@ThibG

ThibG Apr 19, 2018

Collaborator

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.

Collaborator

ThibG commented Apr 19, 2018

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.

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 19, 2018

Member

@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...

Member

Gargron commented Apr 19, 2018

@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...

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 19, 2018

Member

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.

Member

Gargron commented Apr 19, 2018

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.

@nightpool

This comment has been minimized.

Show comment
Hide comment
@nightpool

nightpool Apr 19, 2018

Collaborator
Collaborator

nightpool commented Apr 19, 2018

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 19, 2018

Member

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.

Member

Gargron commented Apr 19, 2018

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.

@ThibG

This comment has been minimized.

Show comment
Hide comment
@ThibG

ThibG Apr 19, 2018

Collaborator

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.

Collaborator

ThibG commented Apr 19, 2018

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.

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 19, 2018

Member

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...

Member

Gargron commented Apr 19, 2018

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...

@ThibG

This comment has been minimized.

Show comment
Hide comment
@ThibG

ThibG Apr 19, 2018

Collaborator

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?

Collaborator

ThibG commented Apr 19, 2018

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?

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 19, 2018

Member

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!

Member

Gargron commented Apr 19, 2018

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!

@nightpool

This comment has been minimized.

Show comment
Hide comment
@nightpool

nightpool Apr 19, 2018

Collaborator
Collaborator

nightpool commented Apr 19, 2018

@ThibG

This comment has been minimized.

Show comment
Hide comment
@ThibG

ThibG Apr 19, 2018

Collaborator

@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).

Collaborator

ThibG commented Apr 19, 2018

@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).

@cwebber

This comment has been minimized.

Show comment
Hide comment
@cwebber

cwebber Apr 20, 2018

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?

cwebber commented Apr 20, 2018

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?

@cwebber

This comment has been minimized.

Show comment
Hide comment
@cwebber

cwebber Apr 20, 2018

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

cwebber commented Apr 20, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment