Fix new project group templates pagination
What does this MR do and why?
Implements a temporary fix for the new project group templates pagination as part of a priority1 bug fix.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Note: Testing requires an instance with many Group templates, the easiest for testing is to force pagination with the following patch
diff --git a/ee/app/controllers/ee/users_controller.rb b/ee/app/controllers/ee/users_controller.rb
index 4caf45581ab4..888f8bd8a4dc 100644
--- a/ee/app/controllers/ee/users_controller.rb
+++ b/ee/app/controllers/ee/users_controller.rb
@@ -34,6 +34,7 @@ def available_group_templates
@groups_with_project_templates = # rubocop:disable Gitlab/ModuleWithInstanceVariables
user.available_subgroups_with_custom_project_templates(params[:group_id])
.page(params[:page])
+ .per(1)
# Workaround: to generate correct COUNT sql:
# https://gitlab.com/gitlab-org/gitlab/-/issues/381077
.tap { |t| t.total_count("#{::Namespace.table_name}.#{::Namespace.primary_key}") }
- Navigate to http://gdk.test:3000/flightjs and create a New subgroup
- Navigate to the sub group and create a project under the subgroup
- Navigate to http://gdk.test:3000/groups/flightjs/-/edit#js-custom-project-templates-settings
- Under Custom project templates select the subgroup created in step 1
- Follow step 1-4 for at least one more group.
- Navigate to
http://gdk.test:3000/projects/new#create_from_template
- Replace
http://gdk.test:3000
with your instance root URL.
- Replace
- Click on
Group
- The pagination on the Group tab should work as expected.
Related to #442350 (closed)
Edited by Jacques Erasmus