diff options
author | luigi <007.lva@gmail.com> | 2021-01-09 18:32:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 00:32:01 +0100 |
commit | 087ed84367537ac168ed3e00bb7eb4bd582dc3d0 (patch) | |
tree | 2374e63ef1aabe4b9991dd30c4eba8adfec89839 /app/services/import_service.rb | |
parent | 93951431269403201550e914dee508a522becf8b (diff) |
Optimize map { ... }.compact calls (#15513)
* Optimize map { ... }.compact using Enumerable#filter_map, supported since Ruby 2.7 * Add poyfill for Enumerable#filter_map
Diffstat (limited to 'app/services/import_service.rb')
-rw-r--r-- | app/services/import_service.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 0c6ef2238..b11532283 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -107,12 +107,12 @@ class ImportService < BaseService end end - statuses = items.map do |uri| + statuses = items.filter_map do |uri| status = ActivityPub::TagManager.instance.uri_to_resource(uri, Status) next if status.nil? && ActivityPub::TagManager.instance.local_uri?(uri) status || ActivityPub::FetchRemoteStatusService.new.call(uri) - end.compact + end account_ids = statuses.map(&:account_id) preloaded_relations = relations_map_for_account(@account, account_ids) |