...
Status:
Status | ||
---|---|---|
|
OVERVIEW
This document describes the main design and implementation decisions behind the "Group Mentions” feature. This feature provides ways for a MM user to mention groups and notify their members (and invite the ones that are not in the channel to the channel).
...
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.
GetGroupsByChannel
, GetGroupsByTeam
, GetGroupsAssociatedToChannelsByTeam
, GetGroups
Storage
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.
...
in the notification phase, when the aggregated number of group members to mention is above 5 a certain threshold N(=5?), we are showing displaying a warning modal (see wireframe), the text message in the modal includes specifies the user count from the largest group in the collection. This is a compromise solution, due to performance constraints further explained further below.
For example, if we mention
@developers
and@board
, where@developers
has 10 users within the channel while@board
only has 2 members in the channel, the warning modal will explain that you are warn the user that she is about to notify@developers
with 10 members in the channel.
If two groups have repeating common users the total count shown to be displayed by the dialog would have to be the union of members for each group within the channel. This would cause a significant performance regression and cannot be done for the MVP.
Future work: Investigate a better solution?
...
The
markdown
component will be modified to usegetAllUserMentionKeys
which contains the union of `getCurrentUserMentionKeys
andgetCurrentUserGroupMentionKeys.
This will ensure that group names will be highlighted for the user as expected.The existing admin setting
enableConfirmNotificationsToChannel
will be used to determine if the warning modal should show up if a group has more than 5 N members in the channel.Upon visiting a channel all the groups that have members within that channel will now be available in can be retrieved by using the
channelMemberCountsByGroup
selector.A utility function
groupsMentionedInText
will be added to get all the groups mentioned in a message before sending.All the groups being mentioned will be retrieved from the Redux state and then the one with the most largest number channel members will be grabbed selected and its member count be used to display the number of users being notified. However, if groups are being mentioned alongside @all or @channel, then the total number of channel members - 1 will be used instead.
...
A new selector will be added to get the list of groups that the current user can be mentioned by:
getCurrentUserGroupMentionKeys
this - it will be used to determine which @group mentions should be highlighted in the chat facing UI. This selector will be used inside ofgetAllUserMentionKeys
to return where we merge its set with the result merged with of callinggetCurrentUserMentionKeys
(which contains regular mentions such as first name / user name etc).New actions and selectors for
getChannelMemberCountsByGroup
have been added which take achannelID
and a booleanincludeTimezones
, returns a list of all groups with members within the channel and number of members in that channel. IfincludeTimezones
is true the function also returns the number of unique timezones for the users in that group.
...
channel: “.../ member_counts_by_group/" channelMemberCountsByGroup`
(GET)
since we extend the range of calls to the GetGroups* methods from the SystemConsole to the chat-facing area we will remove the existing permission check from the following API calls:
...
GetGroups
GetGroupsForTeam
…getGroups, getGroupsByTeam
The USE_GROUP_MENTIONS
permission check is being done now in Redux, where we check the current user’s permission to fetch the mentionable groups.
Storage:
we will add the following new stored procedures:
...
GetMemberUsersNotInChannel
- returns a slice of users that are members of a group that exist in the team that the channel belongs to but do not exist in the channel. The intersection of (users in team) & (users in group) & (users not in channel)
Tickets
Group Mentions - Show a confirmation dialog when mentioning a group with too many users
...
we will add a new column to the UserGroups table to tag the groups that are enabled for mentioning:
AllowReference AllowReference
: boolean
Permissions
we will add a new permission USEpermission
USE_GROUP_
MENTIONSMENTIONS
- this allows us to
Tickets
Create use_group_mentions permission
https://mattermost.atlassian.net/browse/MM-23019
Websockets updatesTicket: Ensure websockets are updating the referenceable groups (et al) in Redux for group-mentions
...