Fix search policy

This commit is contained in:
KMY 2023-04-05 14:36:15 +09:00
parent 5e8bdaaab6
commit fdf3b93c36

View file

@ -20,7 +20,15 @@ class StatusPolicy < ApplicationPolicy
end
def search?
show? && (record.public_visibility? || record.public_unlisted_visibility?)
return false if author.suspended?
if requires_mention?
owned? || mention_exists?
elsif !public?
owned? || following_author? || mention_exists?
else
current_account.nil? || (!author_blocking? && !author_blocking_domain?)
end
end
def reblog?
@ -59,6 +67,10 @@ class StatusPolicy < ApplicationPolicy
record.private_visibility?
end
def public?
record.public_visibility? || record.public_unlisted_visibility?
end
def mention_exists?
return false if current_account.nil?