Apply anonymous blocks without an owner as global
This commit is contained in:
parent
0bbb435858
commit
74e309e9fc
|
@ -72,7 +72,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 && target_user.anonymous_blocks.where(identifier: question.author_identifier).any?)
|
(anonymous && AnonymousBlock.where(identifier: question.author_identifier, user_id: [target_user.id, nil]).any?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_user
|
def source_user
|
||||||
|
|
|
@ -79,6 +79,18 @@ describe UseCase::Question::Create do
|
||||||
|
|
||||||
it_behaves_like "creates the question", false
|
it_behaves_like "creates the question", false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "question is from an anon who is blocked globally" do
|
||||||
|
before do
|
||||||
|
AnonymousBlock.create!(
|
||||||
|
identifier: author_identifier,
|
||||||
|
question_id: FactoryBot.create(:question).id,
|
||||||
|
user_id: nil
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like "creates the question", false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "user signed in" do
|
context "user signed in" do
|
||||||
|
|
Loading…
Reference in New Issue