Add searchability support
This commit is contained in:
parent
a2e674af51
commit
af20b1d2aa
43 changed files with 716 additions and 65 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue