A platform for community discussion. Free, open, simple.
FIX: category slug route was not working for subfolder setup
Arpit Jalan32d6286bea81
diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rbindex 731fecad482..bd662ab1592 100644--- a/app/controllers/list_controller.rb+++ b/app/controllers/list_controller.rb@@ -372,6 +372,10 @@ class ListController < ApplicationControllerif current_slug != real_slugurl = request.fullpath.gsub(current_slug, real_slug)+ if ActionController::Base.config.relative_url_root+ url = url.sub(ActionController::Base.config.relative_url_root, "")+ end+return redirect_to path(url), status: 301enddiff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rbindex 3b54f45d465..1bcab4542d7 100644--- a/spec/requests/list_controller_spec.rb+++ b/spec/requests/list_controller_spec.rb@@ -729,7 +729,15 @@ RSpec.describe ListController doendcontext "with subfolder" do- it "redirects to URL containing the updated slug" do+ it "main category redirects to URL containing the updated slug" do+ set_subfolder "/forum"+ get "/c/#{category.slug}"++ expect(response.status).to eq(301)+ expect(response).to redirect_to("/forum/c/#{category.slug}/#{category.id}")+ end++ it "sub-sub-category redirects to URL containing the updated slug" doset_subfolder "/forum"get "/c/hello/world/bye/#{subsubcategory.id}"