]> cat aescling's git repositories - mastodon.git/commitdiff
Fix VerifyAccountLinksWorker not being queued (#8721)
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 18 Sep 2018 21:57:21 +0000 (23:57 +0200)
committerGitHub <noreply@github.com>
Tue, 18 Sep 2018 21:57:21 +0000 (23:57 +0200)
UX-wise, people expect that saving the profile will re-check links even without changing fields content. Bug-wise, `@account` was undefined.

Regression from #8703

app/services/update_account_service.rb

index 362d80c9e463edec62351945bce5243b30feac48..ec69d944a3dd484d93e7af5aea24c895782a3049 100644 (file)
@@ -9,16 +9,19 @@ class UpdateAccountService < BaseService
       next unless ret
 
       authorize_all_follow_requests(account) if was_locked && !account.locked
-      VerifyAccountLinksWorker.perform_async(@account.id) if account.fields_changed?
+      check_links(account)
     end
   end
 
   private
 
   def authorize_all_follow_requests(account)
-    follow_requests = FollowRequest.where(target_account: account)
-    AuthorizeFollowWorker.push_bulk(follow_requests) do |req|
+    AuthorizeFollowWorker.push_bulk(FollowRequest.where(target_account: account).select(:account_id, :target_account_id)) do |req|
       [req.account_id, req.target_account_id]
     end
   end
+
+  def check_links(account)
+    VerifyAccountLinksWorker.perform_async(account.id)
+  end
 end