FEATURE: Use category_list for selecting categories
This commit is contained in:
parent
1999cd0825
commit
7b8d3a84bd
|
@ -52,7 +52,7 @@ module KnowledgeExplorer
|
|||
category_topic_lists = []
|
||||
|
||||
categories.each do |c|
|
||||
if topic_list = TopicQuery.new(current_user, category: c.id).list_latest
|
||||
if topic_list = TopicQuery.new(current_user, category: c.id, no_subcategories: true).list_latest
|
||||
category_topic_lists << TopicListSerializer.new(topic_list, scope: @guardian).as_json
|
||||
end
|
||||
end
|
||||
|
@ -98,7 +98,7 @@ module KnowledgeExplorer
|
|||
def knowledge_explorer_categories
|
||||
selected_categories = SiteSetting.knowledge_explorer_categories.split("|")
|
||||
|
||||
categories = Category.where('slug IN (?)', selected_categories)
|
||||
categories = Category.where('id IN (?)', selected_categories)
|
||||
|
||||
categories.select { |c| @guardian.can_see_category?(c) }
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ plugins:
|
|||
default: false
|
||||
client: true
|
||||
knowledge_explorer_categories:
|
||||
type: list
|
||||
type: category_list
|
||||
default: ""
|
||||
client: true
|
||||
knowledge_explorer_tags:
|
||||
|
|
|
@ -16,7 +16,7 @@ after_initialize do
|
|||
if Search.respond_to? :advanced_filter
|
||||
Search.advanced_filter(/in:kb/) do |posts|
|
||||
selected_categories = SiteSetting.knowledge_explorer_categories.split("|")
|
||||
categories = Category.where('slug IN (?)', selected_categories).pluck(:id)
|
||||
categories = Category.where('id IN (?)', selected_categories).pluck(:id)
|
||||
|
||||
selected_tags = SiteSetting.knowledge_explorer_tags.split("|")
|
||||
tags = Tag.where('name IN (?)', selected_tags).pluck(:id)
|
||||
|
|
Loading…
Reference in New Issue