From 921c4c12731b927d613766c98797de21dfadef4a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 2 Apr 2024 10:07:31 -0400 Subject: [PATCH] Match comment style of `FeedManager` list/tags checks (#29639) Co-authored-by: Renaud Chaput --- app/lib/feed_manager.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 38a177e645..bf6e6db598 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -431,10 +431,10 @@ class FeedManager # @param [List] list # @return [Boolean] def filter_from_list?(status, list) - if status.reply? && status.in_reply_to_account_id != status.account_id - should_filter = status.in_reply_to_account_id != list.account_id - should_filter &&= !list.show_followed? - should_filter &&= !(list.show_list? && ListAccount.exists?(list_id: list.id, account_id: status.in_reply_to_account_id)) + if status.reply? && status.in_reply_to_account_id != status.account_id # Status is a reply to account other than status account + should_filter = status.in_reply_to_account_id != list.account_id # Status replies to account id other than list account + should_filter &&= !list.show_followed? # List show_followed? is false + should_filter &&= !(list.show_list? && ListAccount.exists?(list_id: list.id, account_id: status.in_reply_to_account_id)) # If show_list? true, check for a ListAccount with list and reply to account return !!should_filter end @@ -449,7 +449,11 @@ class FeedManager # @param [Hash] crutches # @return [Boolean] def filter_from_tags?(status, receiver_id, crutches) - receiver_id == status.account_id || ((crutches[:active_mentions][status.id] || []) + [status.account_id]).any? { |target_account_id| crutches[:blocking][target_account_id] || crutches[:muting][target_account_id] } || crutches[:blocked_by][status.account_id] || crutches[:domain_blocking][status.account.domain] + receiver_id == status.account_id || # Receiver is status account? + ((crutches[:active_mentions][status.id] || []) + [status.account_id]) # For mentioned accounts or status account: + .any? { |target_account_id| crutches[:blocking][target_account_id] || crutches[:muting][target_account_id] } || # - Target account is muted or blocked? + crutches[:blocked_by][status.account_id] || # Blocked by status account? + crutches[:domain_blocking][status.account.domain] # Blocking domain of status account? end # Adds a status to an account's feed, returning true if a status was