From c49805efb1b9eaca46c774ef6f9b27d0f18363c0 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 8a12fc075cc..f0191d4799d 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