From c230c11707ddc685f49117988e20aab7fb070635 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 19 Feb 2016 17:03:23 +1100 Subject: [PATCH] FEATURE: stop removing empty categories users have access to from /categories page This is particularly important for heirarchies of categories where a parent is empty Also, if we hide the blank category, how are we going to create the first topic? Old behavior was hacky. --- app/models/category_list.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/models/category_list.rb b/app/models/category_list.rb index 6f445feaa14..642a18643da 100644 --- a/app/models/category_list.rb +++ b/app/models/category_list.rb @@ -145,15 +145,9 @@ class CategoryList end - # Remove any empty categories unless we can create them (so we can see the controls) def prune_empty - if !@guardian.can_create?(Category) - # Remove categories with no featured topics unless we have the ability to edit one - @categories.delete_if do |c| - c.displayable_topics.blank? && c.description.blank? - end - elsif !SiteSetting.allow_uncategorized_topics - # Don't show uncategorized to admins either, if uncategorized topics are not allowed + if @guardian.can_create?(Category) && !SiteSetting.allow_uncategorized_topics + # HACK: Don't show uncategorized to admins either, if uncategorized topics are not allowed # and there are none. @categories.delete_if do |c| c.uncategorized? && c.displayable_topics.blank?