diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-05-06 12:41:40 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:22 -0500 |
commit | 9f9ee606f32ccf1feb4f387f25a3f860e500f602 (patch) | |
tree | 105d3935f870ef046aca876b96f5f806e1ae2168 | |
parent | e0c6d56f5fd237d927353b38d0e89e53c36b1941 (diff) |
Revise status filter logic.
-rw-r--r-- | app/lib/status_filter.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/lib/status_filter.rb b/app/lib/status_filter.rb index 4588796dc..6247ca607 100644 --- a/app/lib/status_filter.rb +++ b/app/lib/status_filter.rb @@ -42,20 +42,22 @@ class StatusFilter return false if mentioned_account_ids.include?(account.id) return true if mentioned_account_ids.any? do |mentioned_account_id| - should_filter = account&.user&.setting_hide_mntions_muted && @preloaded_relations[:muting] && @preloaded_relations[:muting][mentioned_account_id] - should_filter ||= account&.user&.setting_hide_mntions_blocked && @preloaded_relations[:blocking] && @preloaded_relations[:blocking][mentioned_account_id] - if status.reply? - if status.private_visibility? - should_filter ||= (account&.user&.setting_hide_mntions_packm8 && @preloaded_relations[:following] && !@preloaded_relations[:following][mentioned_account_id]) - end - should_filter ||= account&.user&.setting_hide_mntions_blocker && Account.find(mentioned_account_id)&.blocking?(status.account_id) + return true if @preloaded_relations[:muting] && account&.user&.setting_hide_mntions_muted && @preloaded_relations[:muting][mentioned_account_id] + return true if @preloaded_relations[:blocking] && account&.user&.setting_hide_mntions_blocked && @preloaded_relations[:blocking][mentioned_account_id] + + if @preloaded_relations[:blocked_by] + return true if account&.user&.setting_hide_mntions_blocker && @preloaded_relations[:blocked_by][mentioned_account_id] + else + return true if account&.user&.setting_hide_mntions_blocker && Account.find(mentioned_account_id)&.blocking?(account.id) end - should_filter + + return false unless status.private_visibility? && status.reply? + @preloaded_relations[:following] && account&.user&.setting_hide_mntions_packm8 && !@preloaded_relations[:following][mentioned_account_id] end - return true if account&.user&.setting_hide_mntions_packm8 && status.reply? && status.private_visibility? && (mentioned_account_ids - account.following_ids).any? - return true if account&.user&.setting_hide_mntions_muted && account.muting?(mentioned_account_ids) - account&.user&.setting_hide_mntions_blocked && account.blocking?(mentioned_account_ids) + return true if !@preloaded_relations[:following] && account&.user&.setting_hide_mntions_packm8 && status.private_visibility? && status.reply? && (mentioned_account_ids - account.following_ids).any? + return true if !@preloaded_relations[:muting] && account&.user&.setting_hide_mntions_muted && account.muting?(mentioned_account_ids) + return true if !@preloaded_relations[:blocking] && account&.user&.setting_hide_mntions_blocked && account.blocking?(mentioned_account_ids) end def reply_to_blocked? |