mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:04:53 +08:00
FIX: Make edit categories sidebar modal work more intuitively (#27111)
* Load search results in displayed order so that when more categories are loaded on scroll, they appear at the end, * Limit the number of subcategories that are shown per category and display 'show more' links,
This commit is contained in:

committed by
GitHub

parent
831b1fee36
commit
63e8c79e2f
@ -1550,4 +1550,19 @@ RSpec.describe Category do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe ".limited_categories_matching" do
|
||||
before_all { SiteSetting.max_category_nesting = 3 }
|
||||
|
||||
fab!(:foo) { Fabricate(:category, name: "foo") }
|
||||
fab!(:bar) { Fabricate(:category, name: "bar", parent_category: foo) }
|
||||
fab!(:baz) { Fabricate(:category, name: "baz", parent_category: bar) }
|
||||
|
||||
it "produces results in depth-first pre-order" do
|
||||
SiteSetting.max_category_nesting = 3
|
||||
expect(Category.limited_categories_matching(nil, nil, nil, "baz").pluck(:name)).to eq(
|
||||
%w[foo bar baz],
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user