0
0
Fork 0

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 35 deletions

View file

@ -120,7 +120,7 @@ class ImportService < BaseService
end
account_ids = statuses.map(&:account_id)
preloaded_relations = relations_map_for_account(@account, account_ids)
preloaded_relations = @account.relations_map(account_ids, skip_blocking_and_muting: true)
statuses.keep_if { |status| StatusPolicy.new(@account, status, preloaded_relations).show? }
@ -138,14 +138,4 @@ class ImportService < BaseService
def import_data
Paperclip.io_adapters.for(@import.data).read.force_encoding(Encoding::UTF_8)
end
def relations_map_for_account(account, account_ids)
{
blocking: {},
blocked_by: Account.blocked_by_map(account_ids, account.id),
muting: {},
following: Account.following_map(account_ids, account.id),
domain_blocking_by_domain: {},
}
end
end