Groups can have no owner after deleting members

Summary

Recently, via this ticket (internal only) a case was brought up where a group was left without an owner.

Steps to reproduce

  • Create group sabine_test_1
  • Create group sabine_test_2
  • Invite user sabine.denk14dev_2 to group sabine_test_1 as maintainer
  • Invite user sabine.denk14dev_1 to group sabine_test_2 as owner
  • Invite group sabine_test_2 as owner to sabine_test_1
  • Leave group sabine_test_1
  • Access https://gitlab.com/groups/sabine_test_1/-/group_members \ only one maintainer was visible, but also the group sabine_test_2 as owner
  • In https://gitlab.com/groups/sabine_test_1/-/group_members -> Groups -> delete group membership

Result: https://gitlab.com/sabine_test_1 \ it will have one maintainer (sabine.denk14dev_2) and no owner

Example Project

  1. this ticket (internal only) and this issue (internal only), we were unable to determine what the exact cause was.
  2. https://gitlab.zendesk.com/agent/tickets/326602

What is the current bug behavior?

A group is left without owners

What is the expected correct behavior?

Groups should never be left without owners

Relevant logs and/or screenshots

Output of checks

GitLab.com, GitLab Enterprise Edition 15.4.0-pre 7ca37c2b

Edited by Cynthia "Arty" Ng