mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
DEV: Server-side category routing changes
The routes for categories are changing. The scheme that I intend to move us to is: /c/*slug_path/(:id)/ENDPOINT /c/*slug_path/(:id) This commit adds support for the new scheme to the server side without dropping support for existing URLs. It is necessary to support existing URLs for two reasons: * This commit does not change any client side routing code, * Posts that contain category hashtags that refer to a root category are baked into URLs that do not fit this new scheme, (/c/[id]-[slug])
This commit is contained in:
@ -380,19 +380,15 @@ RSpec.describe ListController do
|
||||
let(:child_category) { Fabricate(:category_with_definition, parent_category: category) }
|
||||
|
||||
context "with valid slug" do
|
||||
it "redirects to the child category" do
|
||||
get "/c/#{category.slug}/#{child_category.slug}/l/latest", params: {
|
||||
id: child_category.id
|
||||
}
|
||||
expect(response).to redirect_to(child_category.url)
|
||||
it "succeeds" do
|
||||
get "/c/#{category.slug}/#{child_category.slug}/#{child_category.id}/l/latest"
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid slug" do
|
||||
it "redirects to child category" do
|
||||
get "/c/random_slug/another_random_slug/l/latest", params: {
|
||||
id: child_category.id
|
||||
}
|
||||
xit "redirects" do
|
||||
get "/c/random_slug/another_random_slug/#{child_category.id}/l/latest"
|
||||
expect(response).to redirect_to(child_category.url)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user