From 099665022f623febf576e8760e5fee70a8581be5 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 27 Dec 2022 07:30:49 +0100 Subject: [PATCH] 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 --- lib/use_case/question/create.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/use_case/question/create.rb b/lib/use_case/question/create.rb index 5c9659fb..0b17d530 100644 --- a/lib/use_case/question/create.rb +++ b/lib/use_case/question/create.rb @@ -83,7 +83,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, nil], user_id: [target_user.id, nil]).any?) end def source_user