|
|
@ -20,6 +20,10 @@ module AccountInteractions |
|
|
|
follow_mapping(Block.where(target_account_id: target_account_ids, account_id: account_id), :target_account_id) |
|
|
|
follow_mapping(Block.where(target_account_id: target_account_ids, account_id: account_id), :target_account_id) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def blocked_by_map(target_account_ids, account_id) |
|
|
|
|
|
|
|
follow_mapping(Block.where(account_id: target_account_ids, target_account_id: account_id), :account_id) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def muting_map(target_account_ids, account_id) |
|
|
|
def muting_map(target_account_ids, account_id) |
|
|
|
Mute.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |mute, mapping| |
|
|
|
Mute.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |mute, mapping| |
|
|
|
mapping[mute.target_account_id] = { |
|
|
|
mapping[mute.target_account_id] = { |
|
|
@ -38,8 +42,12 @@ module AccountInteractions |
|
|
|
|
|
|
|
|
|
|
|
def domain_blocking_map(target_account_ids, account_id) |
|
|
|
def domain_blocking_map(target_account_ids, account_id) |
|
|
|
accounts_map = Account.where(id: target_account_ids).select('id, domain').map { |a| [a.id, a.domain] }.to_h |
|
|
|
accounts_map = Account.where(id: target_account_ids).select('id, domain').map { |a| [a.id, a.domain] }.to_h |
|
|
|
blocked_domains = AccountDomainBlock.where(account_id: account_id, domain: accounts_map.values).pluck(:domain) |
|
|
|
blocked_domains = domain_blocking_map_by_domain(accounts_map.values.compact, account_id) |
|
|
|
accounts_map.map { |id, domain| [id, blocked_domains.include?(domain)] }.to_h |
|
|
|
accounts_map.map { |id, domain| [id, blocked_domains[domain]] }.to_h |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def domain_blocking_map_by_domain(target_domains, account_id) |
|
|
|
|
|
|
|
follow_mapping(AccountDomainBlock.where(account_id: account_id, domain: target_domains), :domain) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
private |
|
|
|