Skip to content

Commit

Permalink
Change search API to be accessible without being logged in (mastodon#…
Browse files Browse the repository at this point in the history
…18963)

But with the resolve option turned off
  • Loading branch information
Gargron authored and kadoshita committed Nov 19, 2022
1 parent 7b7b3ab commit 79c85e3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/controllers/api/v2/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ class Api::V2::SearchController < Api::BaseController

RESULTS_LIMIT = 50

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)
Expand All @@ -24,7 +23,7 @@ def search_results
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

Expand Down

0 comments on commit 79c85e3

Please sign in to comment.