mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:12:46 +08:00
Show empty categories with descriptions to everyone
This commit is contained in:
parent
ae93fcebde
commit
24617dd776
|
@ -115,7 +115,7 @@ class CategoryList
|
|||
def prune_empty
|
||||
unless @guardian.can_create?(Category)
|
||||
# Remove categories with no featured topics unless we have the ability to edit one
|
||||
@categories.delete_if { |c| c.displayable_topics.blank? }
|
||||
@categories.delete_if { |c| c.displayable_topics.blank? && c.description.nil? }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -61,11 +61,17 @@ describe CategoryList do
|
|||
category_list.categories.should be_blank
|
||||
end
|
||||
|
||||
it "returns empty the empty for those who can create them" do
|
||||
it "returns empty categories for those who can create them" do
|
||||
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
|
||||
category_list.categories.should_not be_blank
|
||||
end
|
||||
|
||||
it "returns empty categories with descriptions" do
|
||||
Fabricate(:category, description: 'The category description.')
|
||||
Guardian.any_instance.expects(:can_create?).with(Category).returns(false)
|
||||
category_list.categories.should_not be_blank
|
||||
end
|
||||
|
||||
it 'returns the empty category and a non-empty category for those who can create them' do
|
||||
category_with_topics = Fabricate(:topic, category: Fabricate(:category))
|
||||
Guardian.any_instance.expects(:can_create?).with(Category).returns(true)
|
||||
|
|
Loading…
Reference in New Issue
Block a user