Refactoring relations_map (#24195)

This commit is contained in:
Takeshi Umeda
2023-03-21 18:32:58 +09:00
committed by GitHub
parent 9f8d1601a4
commit 38c84f57b6
4 changed files with 18 additions and 35 deletions

View File

@ -292,6 +292,21 @@ module AccountInteractions
end
end
def relations_map(account_ids, domains = nil, **options)
relations = {
blocked_by: Account.blocked_by_map(account_ids, id),
following: Account.following_map(account_ids, id),
}
return relations if options[:skip_blocking_and_muting]
relations.merge!({
blocking: Account.blocking_map(account_ids, id),
muting: Account.muting_map(account_ids, id),
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, id),
})
end
private
def remove_potential_friendship(other_account)