Fix uncategorized topics not being shown on categories page

This commit is contained in:
Neil Lalonde 2013-08-15 15:07:42 -04:00
parent 5a4b939cf7
commit 8a96c4c0f6
2 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,8 @@ class CategoryList
@categories.insert(insert_at || @categories.size, uncategorized) @categories.insert(insert_at || @categories.size, uncategorized)
end end
if @all_topics.present? && uncategorized.present? if uncategorized.present?
@all_topics ||= []
uncategorized.displayable_topics = uncategorized_topics uncategorized.displayable_topics = uncategorized_topics
@all_topics << uncategorized_topics @all_topics << uncategorized_topics
@all_topics.flatten! @all_topics.flatten!

View File

@ -22,6 +22,7 @@ describe CategoryList do
category.slug.should == SiteSetting.uncategorized_name category.slug.should == SiteSetting.uncategorized_name
category.topics_week.should == 1 category.topics_week.should == 1
category.featured_topics.should == [topic] category.featured_topics.should == [topic]
category.displayable_topics.should == [topic] # CategoryDetailedSerializer needs this attribute
end end
it 'does not return an invisible topic' do it 'does not return an invisible topic' do