mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: Topic.time_to_first_response should include sub-sub-categories (#9349)
This commit is contained in:
@ -2348,6 +2348,20 @@ describe Topic do
|
||||
expect(Topic.time_to_first_response_total).to eq(1)
|
||||
end
|
||||
|
||||
it "should have results if there's a topic with replies" do
|
||||
SiteSetting.max_category_nesting = 3
|
||||
|
||||
category = Fabricate(:category_with_definition)
|
||||
subcategory = Fabricate(:category_with_definition, parent_category_id: category.id)
|
||||
subsubcategory = Fabricate(:category_with_definition, parent_category_id: subcategory.id)
|
||||
|
||||
topic = Fabricate(:topic, category: subsubcategory, created_at: 3.hours.ago)
|
||||
Fabricate(:post, topic: topic, user: topic.user, post_number: 1, created_at: 3.hours.ago)
|
||||
Fabricate(:post, topic: topic, post_number: 2, created_at: 2.hours.ago)
|
||||
|
||||
expect(Topic.time_to_first_response_total(category_id: category.id)).to eq(1)
|
||||
end
|
||||
|
||||
it "should only count regular posts as the first response" do
|
||||
topic = Fabricate(:topic, created_at: 5.hours.ago)
|
||||
Fabricate(:post, topic: topic, user: topic.user, post_number: 1, created_at: 5.hours.ago)
|
||||
|
Reference in New Issue
Block a user