From 0fd8575fffd15380a2a4739a6790f85925bffa95 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 3 Jun 2019 20:04:00 +0200 Subject: Handle blank poll options more gracefully (#10946) Pleroma currently allows (erroneously imho) empty poll options, that is, options with an empty (but existing) `name`. --- app/lib/activitypub/activity/create.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/lib/activitypub') diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index d1fd1411e..4e7f922e9 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -334,7 +334,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 -- cgit