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.
This commit is contained in:
Sam 2016-02-19 17:03:23 +11:00
parent ab06f86fbe
commit c230c11707

View File

@ -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?