]> cat aescling's git repositories - mastodon.git/commitdiff
Add env variable to control search limit
authorLady Lumb <42786600+LadyLumb@users.noreply.github.com>
Fri, 31 May 2019 08:48:11 +0000 (01:48 -0700)
committerThibG <thib@sitedethib.com>
Sat, 20 Jul 2019 14:39:48 +0000 (16:39 +0200)
Changed the default search limit to allow a variable called MAX_SEARCH_RESULTS in the .env.production file to change the maximum search results limit.

app/controllers/api/v1/search_controller.rb

index 6131cbbb69fb1250ea102112ac51d0ebe04d200a..4fb869bb913013e21b4a979b48e0e9795bf0a7bf 100644 (file)
@@ -3,7 +3,7 @@
 class Api::V1::SearchController < Api::BaseController
   include Authorization
 
-  RESULTS_LIMIT = 20
+  RESULTS_LIMIT = (ENV['MAX_SEARCH_RESULTS'] || 20).to_i
 
   before_action -> { doorkeeper_authorize! :read, :'read:search' }
   before_action :require_user!