]> cat aescling's git repositories - mastodon.git/commitdiff
Handle blank poll options more gracefully (#10946)
authorThibG <thib@sitedethib.com>
Mon, 3 Jun 2019 18:04:00 +0000 (20:04 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 3 Jun 2019 18:04:00 +0000 (20:04 +0200)
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.

app/lib/activitypub/activity/create.rb

index 2bc33c04bfeb65de2de095a38bdb042bab4c46b1..f55dd35b2c7f8580f1eca87652bd1a3b3259cbb4 100644 (file)
@@ -234,7 +234,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     @account.polls.new(
       multiple: multiple,
       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 }
     )
   end