# frozen_string_literal: true
class StatusFilter
attr_reader :status, :account
def initialize(status, account)
@status = status
@account = account
end
def filtered?
blocked_by_policy? || (account_present? && filtered_status?) || silenced_account?
private
def account_present?
!account.nil?
def filtered_status?
blocking_account? || blocking_domain? || muting_account?
def blocking_account?
account.blocking? status.account_id
def blocking_domain?
account.domain_blocking? status.account_domain
def muting_account?
account.muting? status.account_id
def silenced_account?
status_account_silenced? && !account_following_status_account?
def status_account_silenced?
status.account.silenced?
def account_following_status_account?
account&.following? status.account_id
def blocked_by_policy?
!policy_allows_show?
def policy_allows_show?
StatusPolicy.new(account, status).show?