Don't show invisible topics in uncategorized on categories page

This commit is contained in:
Neil Lalonde 2013-06-21 11:36:00 -04:00
parent 455742d3ee
commit bfdbf373f3
2 changed files with 8 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class CategoryList
# Support for uncategorized topics
uncategorized_topics = Topic
.listable_topics
.visible
.where(category_id: nil)
.topic_list_order
.limit(SiteSetting.category_featured_topics)

View File

@ -12,7 +12,7 @@ describe CategoryList do
category_list.categories.should be_blank
end
context "with an uncateorized topic" do
context "with an uncategorized topic" do
let!(:topic) { Fabricate(:topic)}
let(:category) { category_list.categories.first }
@ -24,6 +24,12 @@ describe CategoryList do
category.featured_topics.should == [topic]
end
it 'does not return an invisible topic' do
invisible_topic = Fabricate(:topic)
invisible_topic.update_status('visible', false, Fabricate(:admin))
expect(category.featured_topics).to_not include(invisible_topic)
end
end
end