1
0
Fork 0
forked from gitea/nas

Add my reacted statuses search

This commit is contained in:
KMY 2023-09-15 18:50:45 +09:00
parent 7b88422644
commit 5fb6bce744
9 changed files with 124 additions and 16 deletions

View file

@ -86,6 +86,7 @@ class Status < ApplicationRecord
has_many :referenced_by_statuses, through: :referenced_by_status_objects, class_name: 'Status', source: :status
has_many :capability_tokens, class_name: 'StatusCapabilityToken', inverse_of: :status, dependent: :destroy
has_many :bookmark_category_relationships, class_name: 'BookmarkCategoryStatus', inverse_of: :status, dependent: :destroy
has_many :bookmark_categories, class_name: 'BookmarkCategory', through: :bookmark_category_relationships, source: :bookmark_category
has_many :joined_bookmark_categories, class_name: 'BookmarkCategory', through: :bookmark_category_relationships, source: :bookmark_category
# Those associations are used for the private search index
@ -93,6 +94,7 @@ class Status < ApplicationRecord
has_many :local_favorited, -> { merge(Account.local) }, through: :favourites, source: :account
has_many :local_reblogged, -> { merge(Account.local) }, through: :reblogs, source: :account
has_many :local_bookmarked, -> { merge(Account.local) }, through: :bookmarks, source: :account
has_many :local_bookmark_categoried, -> { merge(Account.local) }, through: :bookmark_categories, source: :account
has_many :local_emoji_reacted, -> { merge(Account.local) }, through: :emoji_reactions, source: :account
has_many :local_referenced, -> { merge(Account.local) }, through: :referenced_by_statuses, source: :account
@ -435,6 +437,12 @@ class Status < ApplicationRecord
compute_searchability
end
def searchable_visibility
return limited_scope if limited_visibility? && !none_limited?
visibility
end
class << self
def selectable_visibilities
visibilities.keys - %w(direct limited)