Validate milestone title for group import

What does this MR do and why?

This MR ensures file-based group imports observe milestone title rules (see Milestone titles should be unique in group hier... (!142857 - merged))

The rules are:

  • for project milestones, uniqueness in ancestors only, rather than the entire namespace, across both group and project milestone titles

  • for group milestones, uniqueness within the hierarchy - ancestors and children only, not across the entire root ancestor namespace

However, this MR only covers group milestones because Importer:Group Export/Import does not import any project resources.

For additional context, in the UI, when a user attempts to create a milestone with an existing title, they will see an error message and the milestone will not be created:

form_contains_error

Before this change however, when importing a group via file-based import, existing group milestones with duplicate names would have their group_id updated to the new destination resource id, thereby "moving" from their original group to the newly imported group.

How to set up and validate locally

Before

  1. On master, create a group, create a milestone for the group titled "17.0", create a subgroup, create a milestone for the subgroup titled "18.0", create a project in the subgroup, create a milestone for the project titled "19.0"
  2. Open each milestones list page for the group, subgroup, and project for later reference.
  3. Export the group `settings > general > advanced > export group
  4. Once ready, download the export file
  5. Navigate to the group home page
  6. Create a new subgroup
  7. Select the "You can also import an existing group." option neat the top of the form
  8. Import the group with the "Import group from file" option, using the downloaded export file
  9. Once the import finishes, visit the milestones list page for the group, subgroup, and project and refresh each page.
  10. Observe the milestones for the group and subgroup are no longer visible.
  11. Visit the corresponding imported group and imported subgroup milestone list pages
  12. Observe the milestones now appear on these pages

After

  1. Check out to the 588256-validate-milestone-title
  2. Repeat steps 1 to 9 above.
  3. Observe the milestones for the group and subgroup are still visible.
  4. Visit the corresponding imported group and imported subgroup milestone list pages
  5. Observe the milestones do not appear on these pages

References

Screenshots or screen recordings

original milestones imported milestones
original-milestones imported-milestones

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #588256 (closed)

Edited by Carla Drago

Merge request reports

Loading