From 3fa72fd56cc325c523493ab631286a94f30910f6 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Mon, 28 Nov 2022 22:53:51 -0800 Subject: [PATCH] Don't search unlisted statuses --- .env.production.sample | 4 ++-- app/chewy/statuses_index.rb | 2 +- app/services/search_service.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.production.sample b/.env.production.sample index 64b6e4979d..a50d301994 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -283,10 +283,10 @@ MAX_POLL_OPTION_CHARS=100 # Customize the number of hashtags shown in 'Explore' # MAX_TRENDING_TAGS=10 -# Search all visible statuses +# Search all public statuses # (Normally searches only a user's own statuses, favs, bookmarks, and mentions) # Only relevant when elasticsearch is installed -# SEARCH_ALL_VISIBLE_STATUSES=true +# SEARCH_ALL_PUBLIC_STATUSES=true # Maximum custom emoji file sizes # If undefined or smaller than MAX_EMOJI_SIZE, the value diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index a80c6eca23..2984931693 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -71,6 +71,6 @@ class StatusesIndex < Chewy::Index end field :searchable_by, type: 'long', value: ->(status, crutches) { status.searchable_by(crutches) } - field :searchable_by_anyone, type: 'boolean', value: ->(status) { status.public_visibility? or status.unlisted_visibility? } + field :searchable_by_anyone, type: 'boolean', value: ->(status) { status.public_visibility? } end end diff --git a/app/services/search_service.rb b/app/services/search_service.rb index b82b66c91b..ca1dd855a1 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class SearchService < BaseService - SEARCH_ALL_VISIBLE_STATUSES = ENV['SEARCH_ALL_VISIBLE_STATUSES'] == 'true' + SEARCH_ALL_PUBLIC_STATUSES = ENV['SEARCH_ALL_PUBLIC_STATUSES'] == 'true' def call(query, account, limit, options = {}) @query = query&.strip