• Kerri Miller's avatar
    Add project group and ancestors to group list · c099a291
    Kerri Miller authored
    This addresses an issue that arises when the owner of a path is the
    group under which the project lives (such as `@gitlab-org` for the
    Gitlab project..) Gitlab::CodeOwners::GroupsLoader did not add that
    group to the list of groups when attempting to determine ownership. This
    list of groups is expanded into a list of users that the user
    attempting the action (typically a merge) is compared to. Sinc the
    project's group is not added to the group list, its members are not
    expanded and are thus missing from the list of owners for a given path.
    
    Additionally, this will look not simply at the immediate group of the
    project, but at the entire group tree ancestors to the root group. For
    example, if the "merge_service" project is at
    
    gitlab-org/engineering/source_code/merge_service
    
    ..then any of these groups would be considerable available for listing
    as a code owner without having to be invited to the project:
    
    @gitlab-org
    @gitlab-org/engineering
    @gitlab-org/engineering/source_code
    
    This address both the proximate cause of
    https://gitlab.com/gitlab-org/gitlab/-/issues/216345 but of the
    long-requested feature https://gitlab.com/gitlab-org/gitlab/-/issues/32432
    c099a291
diff_check_spec.rb 12.6 KB