Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle blank poll options more gracefully #10946

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

ClearlyClaire
Copy link
Contributor

Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) name.

In that case, item['name'].presence || item['content'] returns nil, which
causes an error during validation. Using item['name'] || item['content']
instead will still use item['content'] when item['name'] is not set at all,
but return an empty string in Pleroma's case, which will nicely reject the
blank option without raising an error.

@Gargron
Copy link
Member

Gargron commented Jun 3, 2019

Wouldn't it be equally simple to add a .compact to the chain?

Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
@ClearlyClaire
Copy link
Contributor Author

I guess so.

@Gargron Gargron merged commit 3a84bac into mastodon:master Jun 3, 2019
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
rtucker pushed a commit to vulpineclub/mastodon that referenced this pull request Jan 7, 2021
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
messenjahofchrist pushed a commit to Origin-Creative/mastodon that referenced this pull request Jul 30, 2021
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants