From 2b0491bb3cfa1c39a9ece2c4f3585d06205994cf Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 1 Nov 2020 06:34:43 +0100 Subject: [PATCH] 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. --- app/workers/poll_expiration_notify_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb index 8a12fc075c..f0191d4799 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