Merge pull request #948 from Retrospring/bugfix/global-mute-everything

Prevent global anon blocks blocking every anon question with a user
This commit is contained in:
Karina Kwiatek 2023-01-11 12:35:54 +01:00 committed by GitHub
commit e8780783b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,7 +94,7 @@ module UseCase
def filtered?(question)
target_user.mute_rules.any? { |rule| rule.applies_to? question } ||
(anonymous && AnonymousBlock.where(identifier: question.author_identifier, user_id: [target_user.id, nil]).any?) ||
(source_user_id && anonymous && AnonymousBlock.where(target_user_id: [source_user.id, nil], user_id: [target_user.id, nil]).any?) ||
(source_user_id && anonymous && AnonymousBlock.where(target_user_id: source_user.id, user_id: [target_user.id, nil]).any?) ||
(source_user_id && target_user.muting?(source_user))
end