diff options
Diffstat (limited to 'app/services/update_account_service.rb')
-rw-r--r-- | app/services/update_account_service.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index 09ea377e7..ec69d944a 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -2,20 +2,26 @@ class UpdateAccountService < BaseService def call(account, params, raise_error: false) - was_locked = account.locked + was_locked = account.locked update_method = raise_error ? :update! : :update + account.send(update_method, params).tap do |ret| next unless ret + authorize_all_follow_requests(account) if was_locked && !account.locked + 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 |