mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:41:25 +08:00
UX: Improve category filtering and include subcategories
* category_filtering 1. report_top_referred_topics 2. report_top_traffic_sources 3. report_post_edit * category_filtering with subcategory topics 1. report_top_referred_topics 2. report_top_traffic_sources 3. report_post_edit 4. report_posts 5. report_topics 6. report_topics_with_no_response * category_filtering tests (without subcategory topics) 1. report_posts 2. report_topics_with_no_response * subcategory topics tests `in_category_and_subcategories` in `topic_spec.rb` 1. `in_category_and_subcategories` in `topic_spec.rb` 2. topics, posts, flags and topics_with_no_response in `report_spec.rb`
This commit is contained in:
@ -1366,6 +1366,22 @@ describe Topic do
|
||||
expect(Topic.visible).to include c
|
||||
end
|
||||
end
|
||||
|
||||
describe '#in_category_and_subcategories' do
|
||||
it 'returns topics in a category and its subcategories' do
|
||||
c1 = Fabricate(:category)
|
||||
c2 = Fabricate(:category, parent_category_id: c1.id)
|
||||
c3 = Fabricate(:category)
|
||||
|
||||
t1 = Fabricate(:topic, category_id: c1.id)
|
||||
t2 = Fabricate(:topic, category_id: c2.id)
|
||||
t3 = Fabricate(:topic, category_id: c3.id)
|
||||
|
||||
expect(Topic.in_category_and_subcategories(c1.id)).not_to include(t3)
|
||||
expect(Topic.in_category_and_subcategories(c1.id)).to include(t2)
|
||||
expect(Topic.in_category_and_subcategories(c1.id)).to include(t1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#private_topic_timer' do
|
||||
|
Reference in New Issue
Block a user