Commit 86093d5c authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'psk-revert-insights-url-masking' into 'master'

Revert insights page URL masking handler

See merge request gitlab-org/gitlab!73764
parents 7cc93836 8a9e51b0
......@@ -31,24 +31,11 @@ module Routing
end
end
generate_url(masked_params.merge(params: masked_query_params))
Gitlab::Routing.url_helpers.url_for(masked_params.merge(params: masked_query_params))
end
private
def generate_url(masked_params)
# The below check is added since `project/insights` route does not
# work with Rails router `url_for` method.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/343551
if @request.path_parameters[:controller] == 'projects/insights'
default_root_url + "#{Gitlab::Routing.url_helpers.namespace_project_insights_path(masked_params)}"
elsif @request.path_parameters[:controller] == 'groups/insights'
default_root_url + "#{Gitlab::Routing.url_helpers.group_insights_path(masked_params)}"
else
Gitlab::Routing.url_helpers.url_for(masked_params)
end
end
def mask_id(value)
if @request.path_parameters[:controller] == 'projects/blob'
':repository_path'
......
......@@ -20,7 +20,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
describe 'when url has params to mask' do
context 'when project/insights page is loaded' do
let(:masked_url) { "http://localhost//namespace#{group.id}/project#{project.id}/insights/" }
let(:masked_url) { "http://localhost/namespace#{group.id}/project#{project.id}/insights" }
let(:request) do
double(:Request,
path_parameters: {
......@@ -42,7 +42,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
end
context 'when groups/insights page is loaded' do
let(:masked_url) { "http://localhost//groups/namespace#{group.id}/-/insights/" }
let(:masked_url) { "http://localhost/groups/namespace#{group.id}/-/insights" }
let(:request) do
double(:Request,
path_parameters: {
......
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