]> cat aescling's git repositories - mastodon.git/commitdiff
Fix follow requests N+1 (#12004)
authorabcang <abcang1015@gmail.com>
Mon, 30 Sep 2019 15:02:03 +0000 (00:02 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 30 Sep 2019 15:02:03 +0000 (17:02 +0200)
app/services/update_account_service.rb

index ebf24be37698be220593bc7ba40dccee741abbce..4172d577408f4ae88aaeb91ab2fc8b64548f7313 100644 (file)
@@ -21,7 +21,7 @@ class UpdateAccountService < BaseService
 
   def authorize_all_follow_requests(account)
     follow_requests = FollowRequest.where(target_account: account)
-    follow_requests = follow_requests.select { |req| !req.account.silenced? }
+    follow_requests = follow_requests.preload(:account).select { |req| !req.account.silenced? }
     AuthorizeFollowWorker.push_bulk(follow_requests) do |req|
       [req.account_id, req.target_account_id]
     end