~cytrogen/masto-fe

ff3b7069cf9dd8fc3fa479184db833fbd46472a4 — Nick Schonning 2 years ago da3bd91
Autofix Rubocop Style/ConcatArrayLiterals (#23755)

2 files changed, 5 insertions(+), 10 deletions(-)

M .rubocop_todo.yml
M app/lib/feed_manager.rb
M .rubocop_todo.yml => .rubocop_todo.yml +0 -5
@@ 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:

M app/lib/feed_manager.rb => app/lib/feed_manager.rb +5 -5
@@ 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