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/activitypub/process_poll_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/activitypub/process_poll_service.rb')
-rw-r--r-- | app/services/activitypub/process_poll_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/activitypub/process_poll_service.rb b/app/services/activitypub/process_poll_service.rb index 903b6a78a..d83e614d8 100644 --- a/app/services/activitypub/process_poll_service.rb +++ b/app/services/activitypub/process_poll_service.rb @@ -30,7 +30,7 @@ class ActivityPub::ProcessPollService < BaseService voters_count = @json['votersCount'] - latest_options = items.map { |item| item['name'].presence || item['content'] }.compact + latest_options = items.filter_map { |item| item['name'].presence || item['content'] } # If for some reasons the options were changed, it invalidates all previous # votes, so we need to remove them |