Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Autofix Rubocop Style/ConcatArrayLiterals (mastodon#23755)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored May 4, 2023
1 parent da3bd91 commit ff3b706
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions app/lib/feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ def filter_from_home?(status, receiver_id, crutches)
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

Expand Down Expand Up @@ -396,7 +396,7 @@ def filter_from_mentions?(status, receiver_id)
# 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
Expand Down Expand Up @@ -533,10 +533,10 @@ def build_crutches(receiver_id, statuses)

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

Expand Down

0 comments on commit ff3b706

Please sign in to comment.