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

@ -29,6 +29,7 @@ class PublicFeed
scope.merge!(account_filters_scope) if account?
scope.merge!(media_only_scope) if media_only?
scope.merge!(language_scope) if account&.chosen_languages.present?
scope.merge!(public_searchable_scope) if local_only? && !account?
scope.cache_ids.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
end
@ -97,6 +98,10 @@ class PublicFeed
Status.where(language: account.chosen_languages)
end
def public_searchable_scope
Status.where(searchability: 'public').or(Status.where(searchability: nil).merge(Account.where(searchability: 'public')))
end
def account_filters_scope
Status.not_excluded_by_account(account).tap do |scope|
scope.merge!(Status.not_domain_blocked_by_account(account)) unless local_only?