Subgroup path prevents username change to same path

Summary

Existing subgroup paths are preventing users adopting the same path for their username.

Steps to reproduce

  • Create a new root group (GroupA)
  • Create a subgroup within that group (GroupA/SubGroupA)
  • Attempt to change username to the path of above subgroup (SubGroupA)

Example Project

I created the following subgroup:

  • https://gitlab.com/groups/issue-reproduce/random-namespace-i-want

This is currently preventing username change to random-namespace-i-want. random-namespace-i-want is available.

Root level group creation is not affected. random-namespace-i-want will be accepted as the path for a root-level group

What is the current bug behavior?

SubGroup paths are currently preventing users from adopting those usernames

What is the expected correct behavior?

Only existing namespaces at the root level should block username changes. Root level group creation is not affected.

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

gitlab-ce~3293941 v9.4.3

Results of GitLab application Check

gitlab-ce~3293941 v9.4.3

Possible fixes

Change appears to be prevented by the following validation:

  • https://gitlab.com/gitlab-org/gitlab-ce/blob/5388f5ee13c61eb9d686c9c21c027e603bc222b6/app/models/user.rb#L484
Assignee Loading
Time tracking Loading