mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FIX: Load categories with user activity and drafts (#26553)
When lazy load categories is enabled, categories should be loaded with user activity items and drafts because the categories may not be preloaded on the client side.
This commit is contained in:
@ -223,6 +223,19 @@ RSpec.describe Category do
|
||||
end
|
||||
end
|
||||
|
||||
describe "with_parents" do
|
||||
fab!(:category)
|
||||
fab!(:subcategory) { Fabricate(:category, parent_category: category) }
|
||||
|
||||
it "returns parent categories and subcategories" do
|
||||
expect(Category.with_parents([category.id])).to contain_exactly(category)
|
||||
end
|
||||
|
||||
it "returns only categories if top-level categories" do
|
||||
expect(Category.with_parents([subcategory.id])).to contain_exactly(category, subcategory)
|
||||
end
|
||||
end
|
||||
|
||||
describe "security" do
|
||||
fab!(:category) { Fabricate(:category_with_definition) }
|
||||
fab!(:category_2) { Fabricate(:category_with_definition) }
|
||||
|
Reference in New Issue
Block a user