]> git.openstreetmap.org Git - rails.git/commitdiff
Move note query limit values to settings
authorAnton Khorev <tony29@yandex.ru>
Sat, 19 Aug 2023 02:06:00 +0000 (05:06 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 19 Aug 2023 02:06:00 +0000 (05:06 +0300)
app/controllers/api/notes_controller.rb
config/settings.yml

index 5e24532e79bf7f31594a82db9143465aa502dcbf..83024288db43d9963249c301faca3180f457fce8 100644 (file)
@@ -345,13 +345,13 @@ module Api
     # Get the maximum number of results to return
     def result_limit
       if params[:limit]
-        if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
+        if params[:limit].to_i.positive? && params[:limit].to_i <= Settings.max_note_query_limit
           params[:limit].to_i
         else
-          raise OSM::APIBadUserInput, "Note limit must be between 1 and 10000"
+          raise OSM::APIBadUserInput, "Note limit must be between 1 and #{Settings.max_note_query_limit}"
         end
       else
-        100
+        Settings.default_note_query_limit
       end
     end
 
index 49b4531ada4ecd64fec8458a8840924953d9b35c..15a5753e4b860f5c96f6f34989870e88613c6ac2 100644 (file)
@@ -39,6 +39,10 @@ max_number_of_way_nodes: 2000
 max_number_of_relation_members: 32000
 # The maximum area you're allowed to request notes from, in square degrees
 max_note_request_area: 25
+# Default limit on the number of notes returned by the note search api method
+default_note_query_limit: 100
+# Maximum limit on the number of notes returned by the note search api method
+max_note_query_limit: 10000
 # Zoom level to use for postcode results from the geocoder
 postcode_zoom: 15
 # Timeout for API calls in seconds