]> cat aescling's git repositories - mastodon.git/commitdiff
Fix empty votes arbitrarily increasing voters count in polls (#18526)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 26 May 2022 20:06:10 +0000 (22:06 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Fri, 27 May 2022 03:55:21 +0000 (23:55 -0400)
app/services/vote_service.rb

index ccd04dbfcbe0b74a4c76a78d7e47184de2b1e08f..114ec285c8aaf39987a9d5b5afa0f09a97b00262 100644 (file)
@@ -7,6 +7,8 @@ class VoteService < BaseService
   include Lockable
 
   def call(account, poll, choices)
+    return if choices.empty?
+
     authorize_with account, poll, :vote?
 
     @account = account