Fix new project group templates pagination (16-10-stable-ee)
What does this MR do and why?
This is a backport of !147534 (merged) to 6-10-stable-ee
Implements a temporary fix for the new project group templates pagination as part of a priority1 bug fix.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch. -
The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes). -
This MR has a severity label assigned (if applicable). -
Set the milestone of the merge request to match the target backport branch version. -
This MR has been approved by a maintainer (only one approval is required). -
Ensure the e2e:package-and-test-ee
job has either succeeded or been approved by a Software Engineer in Test.
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releases
Slack channel (internal only).
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