The code powering m.abunchtell.com https://m.abunchtell.com
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

22 wiersze
622 B

  1. # frozen_string_literal: true
  2. class UpdateAccountService < BaseService
  3. def call(account, params, raise_error: false)
  4. was_locked = account.locked
  5. update_method = raise_error ? :update! : :update
  6. account.send(update_method, params).tap do |ret|
  7. next unless ret
  8. authorize_all_follow_requests(account) if was_locked && !account.locked
  9. end
  10. end
  11. private
  12. def authorize_all_follow_requests(account)
  13. follow_requests = FollowRequest.where(target_account: account)
  14. AuthorizeFollowWorker.push_bulk(follow_requests) do |req|
  15. [req.account_id, req.target_account_id]
  16. end
  17. end
  18. end