account_reach_finder.rb 445 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. class AccountReachFinder
  3. def initialize(account)
  4. @account = account
  5. end
  6. def inboxes
  7. (followers_inboxes + reporters_inboxes + relay_inboxes).uniq
  8. end
  9. private
  10. def followers_inboxes
  11. @account.followers.inboxes
  12. end
  13. def reporters_inboxes
  14. Account.where(id: @account.targeted_reports.select(:account_id)).inboxes
  15. end
  16. def relay_inboxes
  17. Relay.enabled.pluck(:inbox_url)
  18. end
  19. end