Use `id` from `source_user` inside query

With the proper presence check using `source_user_id` we guarantee `source_user` is there, and so we can use it like in the other query
This commit is contained in:
Andreas Nedbal 2022-12-27 07:30:49 +01:00 committed by Andreas Nedbal
parent 1f401b2e1b
commit 099665022f
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ module UseCase
def filtered?(question) def filtered?(question)
target_user.mute_rules.any? { |rule| rule.applies_to? 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?) || (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, nil], user_id: [target_user.id, nil]).any?)
end end
def source_user def source_user