Commit bc5e58ef authored by Catalin Irimie's avatar Catalin Irimie

Change trailing slash from constraints to default for insights routes

Simply specifying trailing_slash: true as a parameter to the route
matcher adds it as both a constraint and option.

However this means url_for will not be able to generate this dynamically
since trailing_slash is a reserved keyword for url_for and cannot be
used as an option.

This makes the _default_, not constraint to have a trailing slash, so
that path and URL helpers generate it _with_ the trailing slash, but
not _require_ it.
parent e1d2685e
......@@ -71,7 +71,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resource :issues_analytics, only: [:show]
resource :insights, only: [:show], trailing_slash: true do
resource :insights, only: [:show], defaults: { trailing_slash: true } do
collection do
post :query
end
......
......@@ -155,7 +155,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post '/restore' => '/projects#restore', as: :restore
resource :insights, only: [:show], trailing_slash: true do
resource :insights, only: [:show], defaults: { trailing_slash: true } do
collection do
post :query
end
......
......@@ -11,7 +11,7 @@ RSpec.describe Groups::InsightsController do
let(:query_params) { { type: 'bar', query: { issuable_type: 'issue', collection_labels: ['bug'] }, projects: projects_params } }
let(:projects_params) { { only: [project.id, project.full_path] } }
let(:params) { { trailing_slash: true } }
let(:params) { { group_id: parent_group } }
before do
stub_licensed_features(insights: true)
......
......@@ -10,7 +10,7 @@ RSpec.describe Projects::InsightsController do
let(:query_params) { { type: 'bar', query: { issuable_type: 'issue', collection_labels: ['bug'] }, projects: projects_params } }
let(:projects_params) { { only: [project.id, project.full_path] } }
let(:params) { { trailing_slash: true, project_id: project, namespace_id: group } }
let(:params) { { project_id: project, namespace_id: group } }
before do
stub_licensed_features(insights: true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment