about summary refs log tree commit diff
path: root/app/services/activitypub/fetch_featured_collection_service.rb
diff options
context:
space:
mode:
authorluigi <007.lva@gmail.com>2021-01-09 18:32:01 -0500
committerGitHub <noreply@github.com>2021-01-10 00:32:01 +0100
commit087ed84367537ac168ed3e00bb7eb4bd582dc3d0 (patch)
tree2374e63ef1aabe4b9991dd30c4eba8adfec89839 /app/services/activitypub/fetch_featured_collection_service.rb
parent93951431269403201550e914dee508a522becf8b (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/activitypub/fetch_featured_collection_service.rb')
-rw-r--r--app/services/activitypub/fetch_featured_collection_service.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb
index 2c2770466..82c861f5b 100644
--- a/app/services/activitypub/fetch_featured_collection_service.rb
+++ b/app/services/activitypub/fetch_featured_collection_service.rb
@@ -24,8 +24,7 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService
   def process_items(items)
     status_ids = items.map { |item| value_or_id(item) }
                       .reject { |uri| ActivityPub::TagManager.instance.local_uri?(uri) }
-                      .map { |uri| ActivityPub::FetchRemoteStatusService.new.call(uri) }
-                      .compact
+                      .filter_map { |uri| ActivityPub::FetchRemoteStatusService.new.call(uri) }
                       .select { |status| status.account_id == @account.id }
                       .map(&:id)