about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-11-01 06:34:43 +0100
committerGitHub <noreply@github.com>2020-11-01 06:34:43 +0100
commitc49805efb1b9eaca46c774ef6f9b27d0f18363c0 (patch)
tree43b5ffaef0d980d6d565916a278344f1cff2bff9
parentf1f0400adcd667b8ea558dad0bf42236f12530f4 (diff)
Fix poll ending notifications being created for each vote (#15071)
On a poll ending, notifications were created for each vote instead
of for each voter.
-rw-r--r--app/workers/poll_expiration_notify_worker.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb
index 8a12fc075..f0191d479 100644
--- a/app/workers/poll_expiration_notify_worker.rb
+++ b/app/workers/poll_expiration_notify_worker.rb
@@ -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