...
Team : …/ groups_by_channels
getGroupsAssociatedToChannelsByTeam
(GET) - returns for a team, a map of channels constrained by groups and the corresponding groups.
we will update augment the following
GetGroupsgetGroups*
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.
GetGroupsByChannelgetGroupsByChannel, GetGroupsByTeamgetGroupsByTeam, GetGroupsAssociatedToChannelsByTeamgetGroupsAssociatedToChannelsByTeam, GetGroupsgetGroups
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.
...
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 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 be sent, letting the user know that the group mentioned has no members in the current team.
...
in the notification phase, when the aggregated number of group members to mention is above a certain threshold N(=5?), we are displaying a warning modal (see wireframe), the text message in the modal specifies the user count from the largest group in the set of groups selected in the collectionfirst phase. This is a compromise solution, due to performance constraints further explained -see 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 warn the user that she is about to notify@developers
with 10 members in the channel.
If two groups have common users the total count to be displayed by the dialog would have to be the union of members for each group within the channel. This would cause can be done but at a significant performance regressioncost (groups can have a large number of members).
Future work: Investigate a better solution?
...
A new selector will be added to get the list of groups that the current user can be mentioned by:
getCurrentUserGroupMentionKeys
- it will be used to determine which @group mentions should be highlighted in the chat facing UI. This selector will be used inside ofgetAllUserMentionKeys
where we merge its set with the result 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
, flag as arguments and 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.
...