mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: hide category column in topic list only when the current category has no children
This commit is contained in:
@@ -30,7 +30,7 @@ class Site
|
||||
end
|
||||
|
||||
def groups
|
||||
@groups ||= Group.order(:name).map { |g| {:id => g.id, :name => g.name}}
|
||||
@groups ||= Group.order(:name).map { |g| { id: g.id, name: g.name } }
|
||||
end
|
||||
|
||||
def user_fields
|
||||
@@ -41,7 +41,7 @@ class Site
|
||||
@categories ||= begin
|
||||
categories = Category
|
||||
.secured(@guardian)
|
||||
.includes(:topic_only_relative_url)
|
||||
.includes(:topic_only_relative_url, :subcategories)
|
||||
.order(:position)
|
||||
|
||||
unless SiteSetting.allow_uncategorized_topics
|
||||
@@ -62,10 +62,11 @@ class Site
|
||||
categories.each do |category|
|
||||
category.notification_level = category_user[category.id]
|
||||
category.permission = CategoryGroup.permission_types[:full] if allowed_topic_create.include?(category.id)
|
||||
category.has_children = category.subcategories.present?
|
||||
by_id[category.id] = category
|
||||
end
|
||||
|
||||
categories.reject! {|c| c.parent_category_id && !by_id[c.parent_category_id]}
|
||||
categories.reject! { |c| c.parent_category_id && !by_id[c.parent_category_id] }
|
||||
categories
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user