Track question users in anonymous blocks

This commit is contained in:
Andreas Nedbal 2022-12-27 02:29:29 +01:00 committed by Andreas Nedbal
parent e7f60acad5
commit 97736a956d
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,8 @@ class AnonymousBlockController < ApplicationController
AnonymousBlock.create!(
user: params[:global] ? nil : current_user,
identifier: question.author_identifier,
question:
question:,
target_user: question.user
)
inbox_id = question.inboxes.first.id

View File

@ -82,7 +82,8 @@ 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?)
(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?)
end
def source_user