summaryrefslogtreecommitdiff
path: root/app/helpers/routing
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 11:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 11:33:21 +0000
commit7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch)
tree5bdc2229f5198d516781f8d24eace62fc7e589e9 /app/helpers/routing
parent185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff)
downloadgitlab-ce-7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0.tar.gz
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'app/helpers/routing')
-rw-r--r--app/helpers/routing/packages_helper.rb9
-rw-r--r--app/helpers/routing/projects_helper.rb13
-rw-r--r--app/helpers/routing/pseudonymization_helper.rb7
3 files changed, 24 insertions, 5 deletions
diff --git a/app/helpers/routing/packages_helper.rb b/app/helpers/routing/packages_helper.rb
new file mode 100644
index 00000000000..4e76be3b5a3
--- /dev/null
+++ b/app/helpers/routing/packages_helper.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module Routing
+ module PackagesHelper
+ def package_path(package, **options)
+ Gitlab::UrlBuilder.build(package, only_path: true, **options)
+ end
+ end
+end
diff --git a/app/helpers/routing/projects_helper.rb b/app/helpers/routing/projects_helper.rb
index 8c0bd9b1ecc..f4732e398f0 100644
--- a/app/helpers/routing/projects_helper.rb
+++ b/app/helpers/routing/projects_helper.rb
@@ -43,7 +43,14 @@ module Routing
end
def work_item_url(entity, *args)
- project_work_items_url(entity.project, entity.id, *args)
+ unless Feature.enabled?(:use_iid_in_work_items_path, entity.project.group)
+ return project_work_items_url(entity.project, entity.id, *args)
+ end
+
+ options = args.first || {}
+ options[:iid_path] = true
+
+ project_work_items_url(entity.project, entity.iid, **options)
end
def merge_request_url(entity, *args)
@@ -89,7 +96,9 @@ module Routing
private
def use_work_items_path?(issue)
- issue.issue_type == 'task' && issue.project.work_items_feature_flag_enabled?
+ issue.issue_type == 'task'
end
end
end
+
+Routing::ProjectsHelper.prepend_mod
diff --git a/app/helpers/routing/pseudonymization_helper.rb b/app/helpers/routing/pseudonymization_helper.rb
index eb4e5d1c01c..dce0517690d 100644
--- a/app/helpers/routing/pseudonymization_helper.rb
+++ b/app/helpers/routing/pseudonymization_helper.rb
@@ -43,11 +43,12 @@ module Routing
private
def mask_id(value)
- if @request.path_parameters[:controller] == 'projects/blob'
+ case @request.path_parameters[:controller]
+ when 'projects/blob'
':repository_path'
- elsif @request.path_parameters[:controller] == 'projects'
+ when 'projects'
"project#{@project&.id}"
- elsif @request.path_parameters[:controller] == 'groups'
+ when 'groups'
"namespace#{@group&.id}"
else
value