docbrown/app/controllers/history_controller.rb
rhymes 2bf54edb9c Pro: History (#3220)
* Add base history support

* Add tags and ranking and make it work

* Fix styling

* Add article title and text excerpt to the index

* Add pagination support

* Debounce the search to 300ms

* Show history only to pro users

* Use routing helpers instead of hardcoding

* Raise the page size to 100

* Remove console log

* A bit of regrouping
2019-06-18 14:58:24 -04:00

16 lines
466 B
Ruby

class HistoryController < ApplicationController
before_action :generate_algolia_search_key
def index
authorize current_user, :pro_user?
@history_index = true # used exclusively by the ERb templates
end
private
def generate_algolia_search_key
params = { filters: "viewable_by:#{current_user.id}" }
key = ApplicationConfig["ALGOLIASEARCH_SEARCH_ONLY_KEY"]
@secured_algolia_key = Algolia.generate_secured_api_key(key, params)
end
end