]> cat aescling's git repositories - mastodon.git/commitdiff
Fix poll ending notifications being created for each vote (#15071)
authorThibG <thib@sitedethib.com>
Sun, 1 Nov 2020 05:34:43 +0000 (06:34 +0100)
committerGitHub <noreply@github.com>
Sun, 1 Nov 2020 05:34:43 +0000 (06:34 +0100)
On a poll ending, notifications were created for each vote instead
of for each voter.

app/workers/poll_expiration_notify_worker.rb

index 8a12fc075cc18033a1fb0bd894efcdacdba59f83..f0191d4799daad1500eac23433f2b92a981b1fde 100644 (file)
@@ -15,7 +15,7 @@ class PollExpirationNotifyWorker
     end
 
     # Notify local voters
-    poll.votes.includes(:account).map(&:account).select(&:local?).each do |account|
+    poll.votes.includes(:account).group(:account_id).select(:account_id).map(&:account).select(&:local?).each do |account|
       NotifyService.new.call(account, :poll, poll)
     end
   rescue ActiveRecord::RecordNotFound