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/models/notification.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/models/notification.rb')
-rw-r--r-- | app/models/notification.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb index e83123c97..b6db37d6d 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -92,7 +92,7 @@ class Notification < ApplicationRecord end def reload_stale_associations!(cached_items) - account_ids = (cached_items.map(&:from_account_id) + cached_items.map { |item| item.target_status&.account_id }.compact).uniq + account_ids = (cached_items.map(&:from_account_id) + cached_items.filter_map { |item| item.target_status&.account_id }).uniq return if account_ids.empty? |