Polls error handling

(Tobias Eigen) #1

I’m not sure if this is a bug, a feature request, or UX. I have a user who succeeded in saving two polls in the same post with this incorrect syntax, with spaces and a question mark in the name and an extra “=poll” in the middle.

[poll type=single=poll name=One two three?]
- another theme
- one theme

[poll type=multiple=poll name=Four five six?]
- I would like to do one thing. 
- I would like to do another thing

Weirdly, the polls worked for a few days and people were able to vote. Then today there were complaints about not being able to vote. I then went in to edit the post to see what was going on, fixed the syntax and had some difficulty saving… I kept getting a cryptic “500 error”. Only by removing the name from the first poll was I able to succeed in saving the post, but then all the existing votes had disappeared.

I did do an update to discourse over the weekend, and have the elections plugin installed, so there may be some particularities of my setup at play. On try, the polls seem to work.

I’ve explained to the member to use the build polls feature on the menu in future, which does a pretty good job of creating polls without errors. But users will try to experiment with markdown syntax and it would be nice to have better error handling.

Polls not working
(Sam Saffron) #2

Lets test out these buggy polls:

  • another theme
  • one theme

0 voters

  • I would like to do one thing.
  • I would like to do another thing

0 voters

EDIT: they seem to somehow function …

(Tobias Eigen) #3

Thanks for looking at this, Sam! What do you think should have been the behavior based on the broken syntax? It seems to me the poll type should not have worked which I think is what happened with it defaulting to single. Also, I presume the poll name can’t have spaces or questionmark, so what does the code do with that?

(Sam Saffron) #4

I am pretty sure you can name a poll with almost anything … but … why are you even naming them?

[poll name="this is test?"] should work.

(Tobias Eigen) #5

If you look at the OP my questions here are about troubleshooting bad syntax used by a member on my site. I’d like to understand a bit better how it would have been interpreted. It’s not a huge priority but it would help me to help next time there is a problem with polls.

Good to know about the quotes.

My understanding is that if you use two polls in the same topic you have to name one of them. I just checked here and indeed that is the case. The Poll builder gives the second one a name automagically.