Deleting a user deletes sub-group when other owners are inherited

Deleting a user and contributions mentions that only groups owned solely by the user will be removed. There seems to be an edge case with sub-groups that can cause a group to be deleted despite having other inherited/parent owners.

Steps to reproduce:

  1. user1 creates a top-level group
  2. user2 adds user2 to the top-level group
  3. user2 creates a sub-group within this top-level group. This makes user2 the sole explicit owner of the group, however user1 is an inherited owner from the top-level group.
  4. user1 or someone else deletes user2 along with contributions.
  5. Observe that the sub-group no longer exists.

To highlight again, this seems to be due to the sub-group being owned explicitly at that level by the deleted user. We must not be taking inherited owners into account here. Interestingly, this problem does not occur with projects in a similar situation. That is, if user2 created a project in the top-level group and is subsequently deleted, the project remains.

@jeremy Does this fall within Manage?