autocomplete: make number of results configurable (partly).

Add `Danbooru.Autocomplete.MAX_RESULTS` param that controls the number
of results returned by autocomplete.

This does not work with tag autocomplete for Builders. Builder
autocomplete still needs to be refactored and unified with Member
autocomplete.

Also fix a bug in the /saved_searches/labels endpoint where the limit
param wasn't respected.
This commit is contained in:
evazion
2019-11-13 01:39:03 -06:00
parent 89c5ac73af
commit 378559ff47
4 changed files with 16 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ class SavedSearchesController < ApplicationController
end
def labels
@labels = SavedSearch.search_labels(CurrentUser.id, params[:search])
@labels = SavedSearch.search_labels(CurrentUser.id, params[:search]).take(params[:limit].to_i || 10)
respond_with(@labels)
end