Groups without projects do not autocomplete for mentioning
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### 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 #### Screenshot - no autocomplete for `@gitlab-org/graphql-experts` ![Screen_Shot_2020-11-09_at_7.57.54_AM](/uploads/98cd959cf25d6745b66cd8980938e9c1/Screen_Shot_2020-11-09_at_7.57.54_AM.png) #### Screenshot - Group still available when typed out explicitly for `@gitlab-org/graphql-experts` ![Screen_Shot_2020-11-09_at_7.59.14_AM](/uploads/11641c0f484abc503791cf1c48350b86/Screen_Shot_2020-11-09_at_7.59.14_AM.png) ### 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 https://gitlab.com/gitlab-org/gitlab/-/issues/215070#note_480588810
issue