hide saved search functionality if not enabled

This commit is contained in:
Albert Yi
2016-12-21 11:54:43 -08:00
parent ee4ebce4d7
commit 62956be384
14 changed files with 198 additions and 104 deletions

View File

@@ -847,15 +847,19 @@ class User < ActiveRecord::Base
module SavedSearchMethods
def unique_saved_search_categories
categories = saved_searches.pluck(:category)
if categories.any? {|x| x.blank?}
categories.reject! {|x| x.blank?}
categories.unshift(SavedSearch::UNCATEGORIZED_NAME)
if SavedSearch.enabled?
categories = saved_searches.pluck(:category)
if categories.any? {|x| x.blank?}
categories.reject! {|x| x.blank?}
categories.unshift(SavedSearch::UNCATEGORIZED_NAME)
end
categories.uniq!
categories
else
[]
end
categories.uniq!
categories
end
end