Add status_references to full-text search target

This commit is contained in:
KMY 2023-08-25 17:51:49 +09:00
parent bde0ddaca6
commit 3a5b8819d6
3 changed files with 13 additions and 0 deletions

View file

@ -16,6 +16,7 @@ module StatusSearchConcern
ids += mentions.joins(:account).merge(Account.local).active.pluck(:account_id)
ids += favourites.joins(:account).merge(Account.local).pluck(:account_id)
ids += emoji_reactions.joins(:account).merge(Account.local).pluck(:account_id)
ids += references.joins(:account).merge(Account.local).pluck(:account_id)
ids += reblogs.joins(:account).merge(Account.local).pluck(:account_id)
ids += bookmarks.joins(:account).merge(Account.local).pluck(:account_id)
ids += poll.votes.joins(:account).merge(Account.local).pluck(:account_id) if poll.present?
@ -23,6 +24,7 @@ module StatusSearchConcern
ids += preloaded.mentions[id] || []
ids += preloaded.favourites[id] || []
ids += preloaded.emoji_reactions[id] || []
ids += preloaded.status_references[id] || []
ids += preloaded.reblogs[id] || []
ids += preloaded.bookmarks[id] || []
ids += preloaded.votes[id] || []
@ -51,6 +53,7 @@ module StatusSearchConcern
properties << 'embed' if preview_cards.any?(&:video?)
properties << 'sensitive' if sensitive?
properties << 'reply' if reply?
properties << 'reference' if with_status_reference?
end
end
end

View file

@ -268,6 +268,10 @@ class Status < ApplicationRecord
preloadable_poll.present?
end
def with_status_reference?
reference_objects.any?
end
def non_sensitive_with_media?
!sensitive? && with_media?
end