Don't receive questions from muted users
This commit is contained in:
parent
409c8372ba
commit
8017d97784
|
@ -15,6 +15,7 @@ class QuestionWorker
|
||||||
next if f.inbox_locked?
|
next if f.inbox_locked?
|
||||||
next if f.banned?
|
next if f.banned?
|
||||||
next if MuteRule.where(user: f).any? { |rule| rule.applies_to? question }
|
next if MuteRule.where(user: f).any? { |rule| rule.applies_to? question }
|
||||||
|
next if user.muting?(question.user)
|
||||||
|
|
||||||
Inbox.create(user_id: f.id, question_id: question_id, new: true)
|
Inbox.create(user_id: f.id, question_id: question_id, new: true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,7 +80,8 @@ 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?) ||
|
||||||
|
(source_user_id && target_user.muting?(source_user))
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_user
|
def source_user
|
||||||
|
|
Loading…
Reference in New Issue