mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 07:07:43 +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
@ -1443,4 +1443,31 @@ RSpec.describe CategoriesController do
|
||||
expect(response.parsed_body["categories"].map { |c| c["id"] }).not_to include(category.id)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#hierachical_search" do
|
||||
before { sign_in(user) }
|
||||
|
||||
it "produces categories with an empty term" do
|
||||
get "/categories/hierarchical_search.json", params: { term: "" }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["categories"].length).not_to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't produce categories with a very specific term" do
|
||||
get "/categories/hierarchical_search.json", params: { term: "acategorythatdoesnotexist" }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["categories"].length).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't expose secret categories" do
|
||||
category.update!(read_restricted: true)
|
||||
|
||||
get "/categories/hierarchical_search.json", params: { term: "" }
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.parsed_body["categories"].map { |c| c["id"] }).not_to include(category.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user