/saved_searches/labels.json: support wildcards in search[label] param.

This commit is contained in:
evazion
2017-07-11 19:18:46 -05:00
parent 7b05b9dd64
commit dc079d7932
2 changed files with 14 additions and 5 deletions

View File

@@ -17,11 +17,7 @@ class SavedSearchesController < ApplicationController
end
def labels
@labels = SavedSearch.labels_for(CurrentUser.user.id)
if params[:label]
regexp = Regexp.compile(Regexp.escape(params[:label]))
@labels = @labels.grep(regexp)
end
@labels = SavedSearch.search_labels(CurrentUser.id, params[:search])
respond_with(@labels)
end