mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 04:25:06 +01:00
Handle blank poll options more gracefully (#10946)
Pleroma currently allows (erroneously imho) empty poll options, that is, options with an empty (but existing) `name`.
This commit is contained in:
parent
8bd2e4403e
commit
3a84bacf86
@ -234,7 +234,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||||||
@account.polls.new(
|
@account.polls.new(
|
||||||
multiple: multiple,
|
multiple: multiple,
|
||||||
expires_at: expires_at,
|
expires_at: expires_at,
|
||||||
options: items.map { |item| item['name'].presence || item['content'] },
|
options: items.map { |item| item['name'].presence || item['content'] }.compact,
|
||||||
cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 }
|
cached_tallies: items.map { |item| item.dig('replies', 'totalItems') || 0 }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user