about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-28 04:44:59 +0100
committerGitHub <noreply@github.com>2019-03-28 04:44:59 +0100
commitf1bc90ab508cbdebc646324f87db48a9e80036f4 (patch)
treec9e6fff16d8e69ed99e7010cabd4d83d595e5493 /app/workers
parentf46f67d984e4e2deb4bf98cd5c5de813caf66eca (diff)
Rename :poll to :preloadable_poll and :owned_poll to :poll on Status (#10401)
Also, fix some n+1 queries

Resolve #10365
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/activitypub/distribute_poll_update_worker.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb
index d60fde557..5eaca6fda 100644
--- a/app/workers/activitypub/distribute_poll_update_worker.rb
+++ b/app/workers/activitypub/distribute_poll_update_worker.rb
@@ -9,7 +9,7 @@ class ActivityPub::DistributePollUpdateWorker
     @status  = Status.find(status_id)
     @account = @status.account
 
-    return unless @status.poll
+    return unless @status.preloadable_poll
 
     ActivityPub::DeliveryWorker.push_bulk(inboxes) do |inbox_url|
       [payload, @account.id, inbox_url]
@@ -29,7 +29,7 @@ class ActivityPub::DistributePollUpdateWorker
   def inboxes
     return @inboxes if defined?(@inboxes)
 
-    @inboxes = [@status.mentions, @status.reblogs, @status.poll.votes].flat_map do |relation|
+    @inboxes = [@status.mentions, @status.reblogs, @status.preloadable_poll.votes].flat_map do |relation|
       relation.includes(:account).map do |record|
         record.account.preferred_inbox_url if !record.account.local? && record.account.activitypub?
       end