mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-24827] Disable group mentions on e10 or team edition (#14475)
* MM-24827 Disable group mentions when ldap groups not enabled * Trigger CI Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -740,6 +740,10 @@ func (a *App) allowChannelMentions(post *model.Post, numProfiles int) bool {
|
||||
|
||||
// allowGroupMentions returns whether or not the group mentions are allowed for the given post.
|
||||
func (a *App) allowGroupMentions(post *model.Post) bool {
|
||||
if license := a.License(); license == nil || !*license.Features.LDAPGroups {
|
||||
return false
|
||||
}
|
||||
|
||||
if !a.HasPermissionToChannel(post.UserId, post.ChannelId, model.PERMISSION_USE_GROUP_MENTIONS) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -999,6 +999,13 @@ func TestAllowGroupMentions(t *testing.T) {
|
||||
|
||||
post := &model.Post{ChannelId: th.BasicChannel.Id, UserId: th.BasicUser.Id}
|
||||
|
||||
t.Run("should return false without ldap groups license", func(t *testing.T) {
|
||||
allowGroupMentions := th.App.allowGroupMentions(post)
|
||||
assert.False(t, allowGroupMentions)
|
||||
})
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("ldap_groups"))
|
||||
|
||||
t.Run("should return true for a regular post with few channel members", func(t *testing.T) {
|
||||
allowGroupMentions := th.App.allowGroupMentions(post)
|
||||
assert.True(t, allowGroupMentions)
|
||||
|
||||
Reference in New Issue
Block a user