gearheads
/
mastodon
Archived
2
0
Fork 0

Change search API to be accessible without being logged in (#18963)

But with the resolve option turned off
gh/stable
Eugen Rochko 2022-08-28 03:45:19 +02:00 committed by GitHub
parent c99c106ef0
commit c57907737a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -5,8 +5,7 @@ class Api::V2::SearchController < Api::BaseController
RESULTS_LIMIT = 20
before_action -> { doorkeeper_authorize! :read, :'read:search' }
before_action :require_user!
before_action -> { authorize_if_got_token! :read, :'read:search' }
def index
@search = Search.new(search_results)
@ -24,7 +23,7 @@ class Api::V2::SearchController < Api::BaseController
params[:q],
current_account,
limit_param(RESULTS_LIMIT),
search_params.merge(resolve: truthy_param?(:resolve), exclude_unreviewed: truthy_param?(:exclude_unreviewed))
search_params.merge(resolve: user_signed_in? ? truthy_param?(:resolve) : false, exclude_unreviewed: truthy_param?(:exclude_unreviewed))
)
end