Some minor change and spec for Account (#3813)
* Introduce domains method to Account relation Account had followers_domains method, which was excessively specific. Let relation of Account have domains method instead. * Move follow_mapping in Account to AccountInteractions * Introduce shared examples for AccountAvatar inclusion * Cover Account more
This commit is contained in:
parent
98fab24bea
commit
e27f792c24
5 changed files with 380 additions and 76 deletions
|
@ -29,6 +29,12 @@ module AccountInteractions
|
|||
blocked_domains = AccountDomainBlock.where(account_id: account_id, domain: accounts_map.values).pluck(:domain)
|
||||
accounts_map.map { |id, domain| [id, blocked_domains.include?(domain)] }.to_h
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def follow_mapping(query, field)
|
||||
query.pluck(field).each_with_object({}) { |id, mapping| mapping[id] = true }
|
||||
end
|
||||
end
|
||||
|
||||
included do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue