New features for `@` mentions
In GitLab, @-mentions can be used to refer to users by username (like
@DouweM), groups by full path (
@gitlab-org), or to all members of the current project using
@all. In all of these cases, the user or group/project members in question will get a notification email and a todo will be created for them.
Because mentioning every single group or project member is often undesirable, we'd like to be able to mention (and "summon" using a notification and todo) only a subset of a project's members: those members with a specific group/project access level or "role", like Owner, Master, Developer, Reporter, and Guest.
It would also be useful to be able to mention (and "summon") everyone already participating in the current issue or MR, or everyone assigned to it, in one go. These participants and assignees will already get a notification for any comment on an issue or MR if their notification level is set to "Watch" or "Participate", but users who participate in many issues may have set their level to "On mention" or "Disabled" to prevent being overload with notifications.
To prevent a new special @-mention with a special name from conflicting with a user or group with that name, I suggest we use an
We can add all of the following special @@-mentions, although the first iteration only needs to support 1 or 2, as long as it's easily extensible:
@allcan remain supported for backward compatibility)
These options should also show up as autocomplete options in the Markdown textarea if
@@ is typed, just like users, groups and
@all currently show up for
For reference, the special
@all @-mention is currently implemented as follows:
Banzai::Filter::UserReferenceFilter#user_link_filterhandles detecting it,
Banzai::ReferenceParser::UserParser#referenced_byhandles finding the team members it refers to,
Banzai::ReferenceParser::UserParser#nodes_user_can_referencehandles verifying that the author of a comment is actually allowed to use
@all(only team members), and
Banzai::ReferenceParser::UserParser#nodes_visible_to_userhandles verifying that the user viewing a comment is actually allowed to see it.
Currently, one can use
@ all (space added to be safe) to contact all people in the project (and the group according to the auto-complete description), which is not quite desired in case of very large projects (we have other means for that).
Also, there's no way to contact all the people that were involved in a given merge request: watchers, those who replied in the thread, submitter and assignee. Sometimes people mistake the
@ all for this purpose.
Finally, it would be useful to be able to use role names:
- Add project setting to disable the
@channel(or something else you find appropriate) to contact people involved in an MR
@reporters, to contact the people with the relevant roles in a project