Groups without projects do not autocomplete for mentioning
Summary
Gitlab groups do not autocomplete when mentioning unless the group also has a public project.
Steps to reproduce
- Create a sub-group and add some members.
- Only the sub-group members can mention the group.
- Create a public project under the group.
- Everyone who has access to the group can now mention the sub-group
Example Project
We discovered this when we created sub-groups under: https://gitlab.com/gitlab-com/gitlab-ux.
The sub-groups could only be autocompleted when there was a project created under them. These groups were created only for mentions, so we had to create dummy projects as a workaround.
What is the current bug behavior?
Group does not show up in autocomplete
What is the expected correct behavior?
You should not have to create a project in order for group members to use the sub-group for mentions.
Relevant logs and/or screenshots
@gitlab-org/graphql-experts
Screenshot - no autocomplete for
@gitlab-org/graphql-experts
Screenshot - Group still available when typed out explicitly for
Output of checks
This bug happens on GitLab.com
Possible fixes
The issue is somewhere around here https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/projects/participants_service.rb#L49. Specifically the public_or_visible_to_user(current_user)
is suspect, and maybe also the chained visible_groups = project.invited_groups
.
Workaround
Create an empty placeholder
project within group to allow mentions, see #215070 (comment 480588810)