Don't show invisible topics in uncategorized on categories page
This commit is contained in:
parent
455742d3ee
commit
bfdbf373f3
|
@ -68,6 +68,7 @@ class CategoryList
|
||||||
# Support for uncategorized topics
|
# Support for uncategorized topics
|
||||||
uncategorized_topics = Topic
|
uncategorized_topics = Topic
|
||||||
.listable_topics
|
.listable_topics
|
||||||
|
.visible
|
||||||
.where(category_id: nil)
|
.where(category_id: nil)
|
||||||
.topic_list_order
|
.topic_list_order
|
||||||
.limit(SiteSetting.category_featured_topics)
|
.limit(SiteSetting.category_featured_topics)
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe CategoryList do
|
||||||
category_list.categories.should be_blank
|
category_list.categories.should be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with an uncateorized topic" do
|
context "with an uncategorized topic" do
|
||||||
let!(:topic) { Fabricate(:topic)}
|
let!(:topic) { Fabricate(:topic)}
|
||||||
let(:category) { category_list.categories.first }
|
let(:category) { category_list.categories.first }
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@ describe CategoryList do
|
||||||
category.featured_topics.should == [topic]
|
category.featured_topics.should == [topic]
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue