give name to work package short path

This commit is contained in:
Ivan Kuchin
2026-04-08 18:39:26 +02:00
parent 6bac672e60
commit a7892ae6a4
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ Rails.application.routes.draw do
get "/wp(/)" => redirect("#{rails_relative_url_root}/work_packages")
get "/wp/*rest" => redirect { |params, _req|
"#{rails_relative_url_root}/work_packages/#{URI::RFC2396_Parser.new.escape(params[:rest])}"
}
}, as: :work_package_short
# Add catch method for Rack OmniAuth to allow route helpers
# Note: This renders a 404 in rails but is caught by omniauth in Rack before
+5
View File
@@ -56,5 +56,10 @@ RSpec.describe "routes for old issue uris", type: :request do
expect(last_response).to be_redirect
expect(last_response.location).to end_with "/work_packages/1234"
end
it "has a path helper" do
expect(work_package_short_path("123")).to eq("/wp/123")
expect(work_package_short_path(%w[123 a_tab foo])).to eq("/wp/123/a_tab/foo")
end
end
end