about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-02 18:10:49 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-02 18:46:28 +0200
commit4500504ec2be89bdedaef27bbf1cf82f77483ccd (patch)
treec82678352460717534f08b4d71d2ad8f28ec9d81 /app/controllers
parent221580a3afb62b8da047b4feddbb58261ca07fbc (diff)
Revert "Change search API to be accessible without being logged in (#18963)"
This reverts commit c57907737a35d05d4bb936acd662df6ce725456f.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v2/search_controller.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/api/v2/search_controller.rb b/app/controllers/api/v2/search_controller.rb
index d14cd5627..77eeab5b0 100644
--- a/app/controllers/api/v2/search_controller.rb
+++ b/app/controllers/api/v2/search_controller.rb
@@ -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)
@@ -23,7 +24,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