Skip to content

Topics: allow only names that are case insensitive unique

What does this MR do and why?

This MR is the first step of #351871 (closed) and changes the name validation of the Projects::Topic model to ensure that no topic is saved if the name is not case insensitive unique. Previously, the uniqueness of the name has also been validated, but case sensitive.

Remarks:

  • The stricter validation is only taken into account if a topic is created or if the name is changed when updating an existing topic. This means you can still update other attributes of existing topics that currently violate the name validation. Otherwise, you would not be able to just change for example the description of a topic because the validation fails due to the (unchanged) name.
  • If a project is assigned a new topic whose name is already taken (case insensitive), the existing topic with the same case insensitive name is assigned instead. If there are already multiple existing topics with the same case insensitive name, the one with the most assigned projects is assigned.

🛠 with at Siemens

/cc @bufferoverflow

How to set up and validate locally

  1. Visit the topic management in the admin area (http://localhost:3000/admin/topics).
  2. Add/edit topics with and without already taken names
  3. Or create/update topics via the Topics API: https://docs.gitlab.com/ee/api/topics.html

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by charlie ablett

Merge request reports