Skip to content

Handle blank poll options more gracefully#10946

Merged
Gargron merged 1 commit intomastodon:masterfrom
ClearlyClaire:fixes/poll-empty-option
Jun 3, 2019
Merged

Handle blank poll options more gracefully#10946
Gargron merged 1 commit intomastodon:masterfrom
ClearlyClaire:fixes/poll-empty-option

Conversation

@ClearlyClaire
Copy link
Copy Markdown
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
Copy Markdown
Member

Gargron commented Jun 3, 2019

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

@ClearlyClaire ClearlyClaire force-pushed the fixes/poll-empty-option branch from 7dc956b to d30241e Compare June 3, 2019 17:22
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
@ClearlyClaire ClearlyClaire force-pushed the fixes/poll-empty-option branch from d30241e to f67fc06 Compare June 3, 2019 17:23
@ClearlyClaire
Copy link
Copy Markdown
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`.
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