Add searchability support

This commit is contained in:
KMY 2023-04-06 04:27:52 +09:00
parent a2e674af51
commit af20b1d2aa
43 changed files with 716 additions and 65 deletions

View file

@ -1,12 +1,15 @@
# frozen_string_literal: true
class StatusPolicy < ApplicationPolicy
def initialize(current_account, record, preloaded_relations = {})
def initialize(current_account, record, preloaded_relations = {}, preloaded_status_relations = {})
super(current_account, record)
@preloaded_relations = preloaded_relations
@preloaded_status_relations = preloaded_status_relations
end
delegate :reply?, :expired?, to: :record
def show?
return false if author.suspended?
@ -19,18 +22,6 @@ class StatusPolicy < ApplicationPolicy
end
end
def search?
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?
!requires_mention? && (!private? || owned?) && show? && !blocking_author?
end