diff options
author | Matt Jankowski <matt@jankowski.online> | 2024-04-02 10:07:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-02 14:07:31 +0000 |
commit | 921c4c12731b927d613766c98797de21dfadef4a (patch) | |
tree | 9c0d25bb907982b1368c82ea6c0e4685f8d6bbab | |
parent | 0b9d4103cb5502faee4cc61717aa5454f63bc8f5 (diff) |
Match comment style of `FeedManager` list/tags checks (#29639)
Co-authored-by: Renaud Chaput <renchap@gmail.com>
-rw-r--r-- | app/lib/feed_manager.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 38a177e6453..bf6e6db598d 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 |