diff --git a/app/models/category_list.rb b/app/models/category_list.rb index 5690130bc85..fd3d8923122 100644 --- a/app/models/category_list.rb +++ b/app/models/category_list.rb @@ -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) diff --git a/spec/components/category_list_spec.rb b/spec/components/category_list_spec.rb index b3903a63002..a6eb8515eac 100644 --- a/spec/components/category_list_spec.rb +++ b/spec/components/category_list_spec.rb @@ -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