diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/feed_manager.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 87065a198..12df1ab88 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -57,7 +57,6 @@ class FeedManager should_filter &&= status.account_id == list.account_id should_filter &&= !list.show_all_replies? should_filter &&= !(list.show_list_replies? && ListAccount.where(list_id: list.id, account_id: status.in_reply_to_account_id).exists?) - should_filter &&= !(list.show_list_replies? && status.conversation&.account_id.present? && ListAccount.where(list_id: list.id, account_id: status.conversation.account_id).exists?) return false if should_filter end @@ -251,22 +250,22 @@ class FeedManager conversation = status.conversation reblog_conversation = status.reblog&.conversation return false if receiver_id == status.account_id - return true if conversation.blank? - return true unless status.published? && (conversation.public? || conversation.account_id == receiver_id || crutches[:following][conversation.account_id]) + return true unless status.published? && conversation&.account_id.present? + return true unless conversation.public? || receiver_id == conversation.account_id || crutches[:following][conversation.account_id] return true if status.reply? && (status.in_reply_to_id.nil? || status.in_reply_to_account_id.nil?) return true if phrase_filtered?(status, receiver_id, :home) check_for_blocks = crutches[:active_mentions][status.id] || [] check_for_blocks.concat([status.account_id]) - check_for_blocks.concat([conversation.account_id]) unless conversation.account_id.nil? + check_for_blocks.concat([conversation.account_id]) check_for_blocks.concat([status.in_reply_to_account_id]) if status.reply? if status.reblog? - return true if reblog_conversation.blank? + return true if reblog_conversation&.account_id.blank? check_for_blocks.concat([status.reblog.account_id]) check_for_blocks.concat(crutches[:active_mentions][status.reblog_of_id] || []) - check_for_blocks.concat([reblog_conversation.account_id]) unless reblog_conversation.account_id.nil? + check_for_blocks.concat([reblog_conversation.account_id]) check_for_blocks.concat([status.reblog.in_reply_to_account_id]) if status.reblog.reply? end @@ -313,12 +312,18 @@ class FeedManager 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? - 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 + should_filter = blocks_or_mutes?(receiver_id, check_for_blocks, :mentions) + should_filter ||= (status.account.silenced? && !relationship_exists?(receiver_id, status.account_id)) should_filter end + def relationship_exists?(account_id, target_account_id) + Follow.where(account_id: account_id, target_account_id: target_account_id) + .or(Follow.where(account_id: target_account_id, target_account_id: account_id)) + .exists? + end + def filter_from_direct?(status, receiver_id) return false if receiver_id == status.account_id |