Users cannot select namespaces if they haven't created a group

Created by: bb-generation

Let's assume the following scenario:

(User A and User B have just signed up)

  • User A creates a Group X
  • User A assigns the membership 'Owner' to User B to Group X (not a transfer, but an additional membership).
  • User B now wants to create a new project inside the Group X but is now unable to do so, because he can't see the Namespace selection box.

If I'm not mistaken, this is caused by app/models/user.rb:

  def can_select_namespace?
    several_namespaces? || admin
  end

  def several_namespaces?
    namespaces.many?
  end

This seems to ignore namespaces which he was assigned to as an owner and just takes the ones he created into account.

Edit: I should also mention that if User B now creates a Group Y, he is now able to create projects for Group X and Y. (which is a simple workaround)

This bug happens in branch 6-0-stable. I haven't checked the master branch, but I couldn't find any commit which seems to suggest that it was already fixed.