Hide
The session[:search] value is used for eventually saving search history, and also for links to return to search results/next/prev on item detail page. It is set in CatalogController#delete_or_assign_search_session_params
Right now session[:search] only includes request parameters that are on a whitelist. The current whitelist is:
[:q, :qt, :search_field, :f, :per_page, :page, :sort]
(Note it does include page, per_page, sort, etc).
This makes it hard for extensions that add additional parameters, as they are not searched.
Instead, it should save all request parameters except those on a blacklist. The blacklight, I think, should be simply:
["commit", "action", "controller"]
Note this action also does not save keys with blank values, and saves all keys as symbols not strings.
Changing to a whitelist with the above restrictions, it passes all existing specs/features. Will commit soon unless a reason not to appears.
This way plugins can add additional parameters, and they'll just be saved for purposes of both search history and next/prev/back links etc.
Making this change, all current tests still seem to pass.
Show
The session[:search] value is used for eventually saving search history, and also for links to return to search results/next/prev on item detail page. It is set in CatalogController#delete_or_assign_search_session_params
Right now session[:search] only includes request parameters that are on a whitelist. The current whitelist is:
[:q, :qt, :search_field, :f, :per_page, :page, :sort]
(Note it does include page, per_page, sort, etc).
This makes it hard for extensions that add additional parameters, as they are not searched.
Instead, it should save all request parameters except those on a blacklist. The blacklight, I think, should be simply:
["commit", "action", "controller"]
Note this action also does not save keys with blank values, and saves all keys as symbols not strings.
Changing to a whitelist with the above restrictions, it passes all existing specs/features. Will commit soon unless a reason not to appears.
This way plugins can add additional parameters, and they'll just be saved for purposes of both search history and next/prev/back links etc.
Making this change, all current tests still seem to pass.
On further testing, while this technique does seem to work for search history and back-to-search, it does NOT seem to work for next/prev and display of search constraints on item detail page.
Not sure why, need to investigate further. This whole sectio of code is kind of confusing, and some day I'd like to rewrite the whole thing, but not this day.