]> cat aescling's git repositories - mastodon.git/commitdiff
Revert "Change search API to be accessible without being logged in (#18963)"
authorClaire <claire.github-309c@sitedethib.com>
Sun, 2 Oct 2022 16:10:49 +0000 (18:10 +0200)
committeraescling <aescling+gitlab@cat.family>
Thu, 17 Nov 2022 03:35:15 +0000 (22:35 -0500)
This reverts commit c57907737a35d05d4bb936acd662df6ce725456f.

app/controllers/api/v2/search_controller.rb

index 51335f4a607d0add714044b620340c1857fb3fb8..116f53618049d3fab795e419ef3f5c3ce52ced40 100644 (file)
@@ -5,7 +5,8 @@ class Api::V2::SearchController < Api::BaseController
 
   RESULTS_LIMIT = (ENV['MAX_SEARCH_RESULTS'] || 20).to_i
 
-  before_action -> { authorize_if_got_token! :read, :'read:search' }
+  before_action -> { doorkeeper_authorize! :read, :'read:search' }
+  before_action :require_user!
 
   def index
     @search = Search.new(search_results)
@@ -29,7 +30,7 @@ class Api::V2::SearchController < Api::BaseController
       params[:q],
       current_account,
       limit_param(RESULTS_LIMIT),
-      search_params.merge(resolve: user_signed_in? ? truthy_param?(:resolve) : false, exclude_unreviewed: truthy_param?(:exclude_unreviewed))
+      search_params.merge(resolve: truthy_param?(:resolve), exclude_unreviewed: truthy_param?(:exclude_unreviewed))
     )
   end