LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
12.95k stars 860 forks source link

Add native support for polls #787

Open kolgza opened 4 years ago

kolgza commented 4 years ago

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!](https://www.bountysource.com/issues/91770758-add-native-support-for-polls?utm_campaign=plugin&utm_content=tracker%2F126011972&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F126011972&utm_medium=issues&utm_source=github).
Nutomic commented 1 year ago

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

dullbananas commented 1 year ago

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.

BrenoMartinsDeOliveiraVasconcelos commented 1 year ago

Polls needs to exist on Lemmy

Darin755 commented 1 year ago

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

A-Salata commented 1 year ago

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.

snowe2010 commented 1 year ago

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 commented 1 year ago

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

Darin755 commented 1 year ago

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

snowe2010 commented 1 year ago

@Darin755 that is what I'm working on.

AppleSheeple commented 11 months ago

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 commented 11 months ago

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.

snowe2010 commented 11 months ago

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.

Jaoheah commented 11 months ago

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?

snowe2010 commented 10 months ago

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

Jaoheah commented 10 months ago

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

dullbananas commented 8 months ago

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

Jaoheah commented 8 months ago

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.

sallyFoster commented 6 months ago

@dullbananas Yes that would be great!

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

dullbananas commented 6 months ago

@snowe2010 Are you still working on this?

DraconicNEO commented 3 months ago

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.

Nutomic commented 3 months ago

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.

sallyFoster commented 2 months ago

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

Nutomic commented 2 months ago

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

DraconicNEO commented 2 months ago

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.

Nutomic commented 2 months ago

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)

DraconicNEO commented 2 months ago

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.

sallyFoster commented 2 months ago

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

DraconicNEO commented 2 months ago

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.

dessalines commented 2 months ago

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

SleeplessOne1917 commented 2 months ago

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

iByteABit256 commented 1 month ago

Is this still being worked on?

sallyFoster commented 3 weeks ago

@iByteABit256 Doesnt seem like it.

SleeplessOne1917 commented 3 weeks ago

We have a goal for this for NLnet this year, but no one has started on it yet.

dullbananas commented 2 weeks ago

Options should be able to have markdown, including images

DraconicNEO commented 2 weeks ago

Options should be able to have markdown, including images

Would that still be compatible with Mastodon's implementation? Would probably be a good idea to retain that because many people use Lemmy through mastodon, so having them be able to read and respond to the polls here is important, just as much as us being able to respond to theirs if they post into Lemmy communities.

AppleSheeple commented 2 weeks ago

so having them be able to read and respond to the polls here is important

One should consider the possibility that locking the Mastodon crowd out of polls can be a feature, not a bug. But I wouldn't expect many to agree with me on this.

Now that I think about it, one way to control the risk/effects of potential Mastodon brigades, is to show instance level info about votes in client API/UI.

The same would go for upvotes/downvotes actually.

This info can be made available only for instances with >3 votes to avoid leaking info about personal instances which may tie to a single user.