...
“Group-constrained” - when a group is linked to a channel or team and the syncing of its group members is turned on.
...
We can split the group mentioning flow into two phases: Build Suggestions and Notify Members. In the Build Suggestions phase we build the suggestions list that is displayed in the channel UI when the user enters the “@*” text in the channel textbox. In the Notify Members phase we sedn the notifications to the members of the groups being selected in the previous phase. We will detail the design and the API, storage and client supporting changes for both of them.
...
A channel or a team can be in one of two states :
constrained to the group(s)
not constrained by any group.
Depending if the current channel and/or the containing team is group constrained , we can have the following group-mentioning cases:
If the current channel is constrained by the group(s), the user in the channel can only mention one of these groups.
Otherwise, if the current team is constrained to by one or more groups, the user can only mention one or more of these groups.
If neither the current channel is constrained, nor the current team, then the user can mention any group constrained to any channel/group in the system. (currently all groups in MM are linked groups).
While we currently do not have a good grasp estimate of how many groups we can have in an org, we made the assumption that the number is small enough where we could fetch them from the server more than once during a user session (we somewhat optimize this action by retrieving only the mentionable ones). The group mention flow is initiated from a channel's textbox; it is an expensive operation to repeatedly fetch the group(s) from the server as the user types - we will fetch the groups and populate the client state (depending if the channel/team is group-constrained or not) once per team initialization (which means that if we switch teams in the work session we will fetch the teams from the server again).
Future Work: Ideally, We are exploring way to ensure the groups will need to be fetched only once, at server start, not at every team change (and then only updated based on group-related System Console actions). Later this set is updated based on user’s actions (groups removed, etc.)
Duplicate group names
When we enable group mentioning on a group in the System Console, we are also generating the actual group name “group name” property from the group’s display name “display name” (e.g. from display name: “software developers” to ; group name: “@software-developers”). This happens at the server-side and since we enforce the uniqueness of the name
column in the UserGroups table, there is a potential of erroring by error and throwing a SQL exception if there is already a group with the same name already stored. Future Work: Fully We address the duplicate group name case . One solution would be to surface by surfacing the duplicate error in the UI and allow allowing the user to specify a different (custom) group name if the current one is a duplicate of another.
Groups with no team members
When we build the list of groups to mention, the groups are added to the list if the channel/team are group-constrained or not. However, it could be that for some of these groups none of their members are members of the current team. Since the members of these groups are not going to be notified, one solution is to avoid selecting them for inclusion in the mentions suggestion list to begin with. The current plan is to include these groups in the suggestion list.
Future Work: Filter out the groups that have no members in the current team from inclusion in the mentions suggestion list. Another proposed solution is to add an invite flow: “invite them now” quick link.Ticket: https://mattermost.atlassian.net/browse/MM-23816
UI/X (Webapp)
Group Mention Settings Toggle Panel
we will add a new “Group Mention Settings” toggle widget containing a toggle component in the Group Configuration details panel in the System Console. We will change not commit the update of the group states on the server at every UI toggle action (there is no Save action).
...
object at the server until the user clicks on the Save button in the panel - until then, the group is in a draft state. We will validate and warn the user for the following conditions:
group name is empty
group name contains invalid characters (TBD the exact set of characters allowed).
Channel Textbox Suggestions List
when displaying the group mention in the suggestion list, we plan to will include the group group’s name and the group display name. There has been discussion to also display the member count (e. g. : “@software-developers - software developers - 4 members”)
...
Software Developers”.
UI/X (Redux)
Selectors:
searchAssociatedGroupsForReferenceLocal
- allows for searching of mentionable groups based on the user entered text
getAssociatedGroupsForReference
- returns the full list of groups that constrain a channel and/or team (or not), base don the criteria mentioned above. If the current user’s role does not have USE_GROUP_MENTIONS permission, it will return an empty list.
getGroupsAssociatedToTeamForReference
- returns the list of groups that constrain a team
getGroupsAssociatedToChannelForReference
- returns the list of groups that constrain a channel
getAllAssociatedGroupsForReference
- returns the list of groups that constrain a channel or team in the system
Actions:
getGroups
- returns the list of groups from the server filtered byfilter_allow_reference
flag
patchGroup
- patches a group with an newname
orallow_reference
property
getAllGroupsAssociatedToChannelsInTeam
- for every channel that is constrained by one or more groups, returns the corresponding list of groups, indexed by the channel’s id.
REST API
we will add the following new endpoints:
...
we will update the following
GetGroups*
API endpoints with the additionalfilter_allow_reference
filter (default isfalse
), to be able to retrieve from the server only the groups that are enabled for mentions.
...
we will add a new SQL stored-procedure:
getGroupsAssociatedToChannelsByTeam
- for every channel that is constrained by one or more groups, retrieves the corresponding list of groups, indexed by the channel’s id.
Tickets
Display group mentions in suggestions list in the main channel textbox
...
The first step added will be to check if the user creating the post and has access to
PERMISSION_USE_GROUP_MENTIONS
, if not then the behaviour behavior ofSendNotifications
will be unchangedIf group mentions are enabled then all groups that have
AllowReference = 1
will be added to memoryThe
ExplicitMentions
struct will have a new attributeGroupMentions
to store the groups mentioned by thePost.Message
.Once all groups are added to the
GroupMentions
map, group members that exist in the channel will be added to theMentions
map as confirmed mentions in the channel.Group members that exist in the
team
but not in thechannel
will be added toOtherPotentialMentions
and will have an invite message generated for them using the existing logic.If there are no group members in the team that the message is sent to a system message will return letting the user know that the group mentioned has no members in the current team.
...