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 aescling committed Nov 17, 2022
1 parent b02c798 commit b045f46
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 = (ENV['MAX_SEARCH_RESULTS'] || 20).to_i

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 @@ -30,7 +29,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 b045f46

Please sign in to comment.