lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Add native support for polls

Open kolgza opened this issue 4 years ago • 38 comments

Pitch

Add an option when creating a post to add a poll. In my opinion, it should have similar functionality to that of SimpleVote, where registered user would be able to vote (from 0 to 20), add candidates to existing elections, and change their score.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kolgza avatar Jun 07 '20 16:06 kolgza

I think https://lemmy.ml/c/polls shows that this isnt really necessary as a separate feature.

Nutomic avatar Jan 15 '23 21:01 Nutomic

Polls can provide better results if responding is easy because it leads to more responses and reduces the problem of some groups of people caring more about responding to the poll.

When using comments as poll options, responding is hard because you have to go to the comments, wait for the comments page to load, and wait for the upvote to be done before you can return to the posts page.

dullbananas avatar Jun 16 '23 23:06 dullbananas

Polls needs to exist on Lemmy

Honestly it would be nice to be able to quickly get option from a community. Polls should be easy to setup and should be able to be restricted to a single Lemmy instance.

I know you could use comments but comments have there own issues

Darin755 avatar Jun 23 '23 04:06 Darin755

I think https://lemmy.ml/c/polls shows that this isnt really necessary as a separate feature.

I think existence of c/polls shows there is a need for polling feature and a userbase that would greatly benefit from it.

A-Salata avatar Jun 23 '23 14:06 A-Salata

I am working on a polling solution.

Edit: Polling is a huge feature, but it is coming along nicely.

Edit 2: I've got most of the code for creating polls done, I'm working on the UI now. Then I need to work on the actual voting.

snowe2010 avatar Jun 27 '23 22:06 snowe2010

@8ullyMaguire that's a survey, not a poll, but ignoring that, what exactly are you asking for? For post moderators to be able to modify people's comments?

snowe2010 avatar Jul 05 '23 16:07 snowe2010

This might sound silly but why don't we just add a form style post that has radio buttons. It could be slowly introduced in order to allow for greater compatibility

Darin755 avatar Jul 06 '23 16:07 Darin755

@Darin755 that is what I'm working on.

snowe2010 avatar Jul 06 '23 22:07 snowe2010

Edit: See comment below.

~~Preferably, there should be no default between single-choice and multi-choice. At the code (and API) level, it should be an enum, not a flag. And at the UI level, there should be two submit buttons to force the user to choose.~~

AppleSheeple avatar Jul 16 '23 18:07 AppleSheeple

Also, in multiple-choice pulls, min..=max choices allowed should be defined, ~~defaulting to 0..=poll_choices~~ with no defaults, and with the no-choice vote option indicated in the UI for users at submission.

Actually, single-choice can be implemented with 1..=1, which would cancel the (enum) suggestion in my previous comment.

Also, and this is probably needless to say given Lemmy's architecture, current poll results should always be shown to everyone, for voters and non-voters alike. Nothing stupider than other platforms forcing users to vote before they can see the results, with some even introducing a "null vote" to do it. A "null vote" may semantically clash anyway (at least when it comes to users' intuition) with a no-choice vote.

AppleSheeple avatar Jul 17 '23 05:07 AppleSheeple

Nothing stupider than other platforms forcing users to vote before they can see the results, with some even introducing a "null vote" to do it. A "null vote" may semantically clash anyway (at least when it comes to users' intuition) with a no-choice vote.

agreed. I've already implemented that. incredibly idiotic to require a vote.

snowe2010 avatar Jul 17 '23 22:07 snowe2010

Nothing stupider than other platforms forcing users to vote before they can see the results, with some even introducing a "null vote" to do it. A "null vote" may semantically clash anyway (at least when it comes to users' intuition) with a no-choice vote.

agreed. I've already implemented that. incredibly idiotic to require a vote.

Is there a public repo where you are working on the polling feature?

Jaoheah avatar Aug 08 '23 21:08 Jaoheah

@Jaoheah sorry for the delay. I have not pushed to the https://github.com/programming-dot-dev repo yet, but will try to soon.

snowe2010 avatar Aug 14 '23 17:08 snowe2010

@Jaoheah sorry for the delay. I have not pushed to the https://github.com/programming-dot-dev repo yet, but will try to soon.

Thanks for your reply. Just reply to this when you have finished the push. Or maybe @Jaoheah me in the commit comment if that would work at pinging me.

(Sorry for the repost. It was showing twice on the mobile github app, and I thought it glitched and posted twice, so I deleted it)

Jaoheah avatar Aug 14 '23 18:08 Jaoheah

Should it be possible to have expiring polls (prevent users from voting after a chosen amount of time) just like R*ddit?

dullbananas avatar Nov 08 '23 00:11 dullbananas

Should it be possible to have expiring polls (prevent users from voting after a chosen amount of time) just like R*ddit?

That should be an option.

Jaoheah avatar Nov 08 '23 00:11 Jaoheah

@dullbananas Yes that would be great!

@dessalines We were hoping that you were going to add polls on the latest release 😭

sallyFoster avatar Dec 09 '23 15:12 sallyFoster

@snowe2010 Are you still working on this?

dullbananas avatar Dec 27 '23 01:12 dullbananas

Would be good to make it so if implemented it would be interoperable with Mastodon's polling function, that way if a mastodon user creates a Poll post to a Lemmy community it would just work.

DraconicNEO avatar Mar 30 '24 19:03 DraconicNEO

Mastodon federates polls in a quite weird way:

"votersCount": 4,
"oneOf":[
    {
        "type":"Note",
        "name":"Adventure",
        "replies":{
            "type":"Collection",
            "totalItems":3
        }
    },
    {
        "type":"Note",
        "name":"Relaxing",
        "replies":{
            "type":"Collection",
            "totalItems":1
        }
  

So for some reason each vote option is a Note, and the number of votes is represented by an empty collection.

Nutomic avatar Apr 02 '24 09:04 Nutomic

@Nutomic Does that make it impossible to integrate with Lemmy?

sallyFoster avatar Apr 07 '24 20:04 sallyFoster

Its definitely possible, just a bit odd how Mastodon decided to federate it.

Nutomic avatar Apr 08 '24 10:04 Nutomic

Its definitely possible, just a bit odd how Mastodon decided to federate it.

Do other platforms besides Mastodon do it differently? Just curious since polls from Sharkey, Iceshrimp, Misskey, etc. do also seem to work in Mastodon and vice versa. If they do it better we might be able to do it that way and then it would be easier.

DraconicNEO avatar Apr 08 '24 20:04 DraconicNEO

If its compatible with Mastodon then it probably federates in the same way. I coudnt find a poll from these platforms but you can check yourself with curl -H "Accept: application/activity+json" https://oslo.town/@matt/112240525284122641 | jq (replace with url from Sharkey etc)

Nutomic avatar Apr 09 '24 09:04 Nutomic

If its compatible with Mastodon then it probably federates in the same way. I coudnt find a poll from these platforms but you can check yourself with curl -H "Accept: application/activity+json" https://oslo.town/@matt/112240525284122641 | jq (replace with url from Sharkey etc)

I got:

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "Key": "sec:Key",
      "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
      "sensitive": "as:sensitive",
      "Hashtag": "as:Hashtag",
      "quoteUrl": "as:quoteUrl",
      "fedibird": "http://fedibird.com/ns#",
      "quoteUri": "fedibird:quoteUri",
      "toot": "http://joinmastodon.org/ns#",
      "Emoji": "toot:Emoji",
      "featured": "toot:featured",
      "discoverable": "toot:discoverable",
      "schema": "http://schema.org#",
      "PropertyValue": "schema:PropertyValue",
      "value": "schema:value",
      "misskey": "https://misskey-hub.net/ns#",
      "_misskey_content": "misskey:_misskey_content",
      "_misskey_quote": "misskey:_misskey_quote",
      "_misskey_reaction": "misskey:_misskey_reaction",
      "_misskey_votes": "misskey:_misskey_votes",
      "_misskey_summary": "misskey:_misskey_summary",
      "isCat": "misskey:isCat",
      "firefish": "https://joinfirefish.org/ns#",
      "speakAsCat": "firefish:speakAsCat",
      "sharkey": "https://joinsharkey.org/ns#",
      "backgroundUrl": "sharkey:backgroundUrl",
      "listenbrainz": "sharkey:listenbrainz",
      "vcard": "http://www.w3.org/2006/vcard/ns#"
    }
  ],
  "id": "https://fedi.catboy.agency/notes/9rxyaitdtnfn01v1",
  "type": "Question",
  "attributedTo": "https://fedi.catboy.agency/users/9nzdge4pn34t5k21",
  "content": "<p>UwU</p>",
  "published": "2024-04-10T22:33:01.633Z",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "cc": [
    "https://fedi.catboy.agency/users/9nzdge4pn34t5k21/followers"
  ],
  "inReplyTo": null,
  "attachment": [],
  "sensitive": false,
  "tag": [],
  "endTime": null,
  "oneOf": [
    {
      "type": "Note",
      "name": "Yes",
      "replies": {
        "type": "Collection",
        "totalItems": 0
      }
    },
    {
      "type": "Note",
      "name": "No",
      "replies": {
        "type": "Collection",
        "totalItems": 0
      }
    },
    {
      "type": "Note",
      "name": ">w<",
      "replies": {
        "type": "Collection",
        "totalItems": 0
      }
    }
  ]
}

So it seems very similar, which I guess makes sense like you said since it's compatible with Mastodon votes.

DraconicNEO avatar Apr 10 '24 22:04 DraconicNEO

Cool, so do you guys think that this feature could be added on this year?

sallyFoster avatar Apr 17 '24 22:04 sallyFoster

Cool, so do you guys think that this feature could be added on this year?

I hope so, though it is a bit complex so it's likely other more important features will take priority before it.

DraconicNEO avatar Apr 18 '24 05:04 DraconicNEO

Yep we're pretty busy, but PRs would be very welcome here.

dessalines avatar Apr 19 '24 00:04 dessalines

Depending on how big this change is, it could be worth opening an RFC for this.

SleeplessOne1917 avatar Apr 19 '24 15:04 SleeplessOne1917