about summary refs log tree commit diff
path: root/app/lib/account_reach_finder.rb
blob: 706ce8c1fbbbf7776e9119ecad77e7e4b4f7b8d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

class AccountReachFinder
  def initialize(account)
    @account = account
  end

  def inboxes
    (followers_inboxes + reporters_inboxes + relay_inboxes).uniq
  end

  private

  def followers_inboxes
    @account.followers.inboxes
  end

  def reporters_inboxes
    Account.where(id: @account.targeted_reports.select(:account_id)).inboxes
  end

  def relay_inboxes
    Relay.enabled.pluck(:inbox_url)
  end
end