From ff3b7069cf9dd8fc3fa479184db833fbd46472a4 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 3 May 2023 23:57:40 -0400 Subject: [PATCH] Autofix Rubocop Style/ConcatArrayLiterals (#23755) --- .rubocop_todo.yml | 5 ----- app/lib/feed_manager.rb | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bc6c86ed2..c559b7131 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1048,11 +1048,6 @@ Style/CombinableLoops: - 'app/models/form/custom_emoji_batch.rb' - 'app/models/form/ip_block_batch.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/ConcatArrayLiterals: - Exclude: - - 'app/lib/feed_manager.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedVars. Style/FetchEnvVar: diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 7dda6b185..8e619f9cc 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -357,10 +357,10 @@ class FeedManager return true if crutches[:languages][status.account_id].present? && status.language.present? && !crutches[:languages][status.account_id].include?(status.language) check_for_blocks = crutches[:active_mentions][status.id] || [] - check_for_blocks.concat([status.account_id]) + check_for_blocks.push(status.account_id) if status.reblog? - check_for_blocks.concat([status.reblog.account_id]) + check_for_blocks.push(status.reblog.account_id) check_for_blocks.concat(crutches[:active_mentions][status.reblog_of_id] || []) end @@ -396,7 +396,7 @@ class FeedManager # the notification has been checked for mute/block. Therefore, it's not # necessary to check the author of the toot for mute/block again check_for_blocks = status.active_mentions.pluck(:account_id) - check_for_blocks.concat([status.in_reply_to_account]) if status.reply? && !status.in_reply_to_account_id.nil? + check_for_blocks.push(status.in_reply_to_account) if status.reply? && !status.in_reply_to_account_id.nil? should_filter = blocks_or_mutes?(receiver_id, check_for_blocks, :mentions) # Filter if it's from someone I blocked, in reply to someone I blocked, or mentioning someone I blocked (or muted) should_filter ||= (status.account.silenced? && !Follow.where(account_id: receiver_id, target_account_id: status.account_id).exists?) # of if the account is silenced and I'm not following them @@ -533,10 +533,10 @@ class FeedManager check_for_blocks = statuses.flat_map do |s| arr = crutches[:active_mentions][s.id] || [] - arr.concat([s.account_id]) + arr.push(s.account_id) if s.reblog? - arr.concat([s.reblog.account_id]) + arr.push(s.reblog.account_id) arr.concat(crutches[:active_mentions][s.reblog_of_id] || []) end