Subgroup name blocking root group creation with same name

Summary

When a sub group exists with the path "foo/bar", we are not allowed to create a root group "bar".

Steps to reproduce

  1. Create "foo" group
  2. Create "foo/bar" sub group
  3. Try to create "bar" group

Example Project

Currently I've created https://gitlab.com/dajfdshfoasdhfashfi/dhflsadjfhkldsa in my own namespace. Therefore when typing "dhflsadjfhkldsa", it would suggest "dhflsadjfhkldsa1" instead.

What is the current bug behavior?

"Group path is already taken. Suggestions: bar1"

What is the expected correct behavior?

Show "bar" as available new group name

Output of checks

This bug happens on GitLab.com

Possible fixes

I think the suggest action's use of this is too restrictive.

# app/controllers/users_controller.rb
exists = !!Namespace.find_by_path_or_name(namespace_path)

It would return subgroup with the same name, thus blocking the creation of root group.