[MM-21919] Add use_channel_mentions permission (#13781)
* MM-21919 Add channel_mention permission * MM-21919 Fix emojis migration test * Enforce Channel Mentions on the in the posts api * MM-21919 Rename permission to use_channel_mentions Allow posts with channel mentions to still be posted without the permission just don't send notifications to users * MM-21919 Add tests for a post with @all and @here * MM-21919 Add use channel mentions to all roles that have create post * MM-21919 Update app_test to include use_channel_mentions permission in default permissions
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a7854f1b97
Коммит
897715f883
@@ -112,6 +112,30 @@ func TestCreatePost(t *testing.T) {
|
||||
assert.Equal(t, model.StringArray{fileId}, actualPostWithFiles.FileIds)
|
||||
})
|
||||
|
||||
t.Run("creates a post that has channel mentions without the USE_CHANNEL_MENTIONS Permission", func(t *testing.T) {
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
th.RemovePermissionFromRole(model.PERMISSION_USE_CHANNEL_MENTIONS.Id, model.CHANNEL_USER_ROLE_ID)
|
||||
|
||||
post.RootId = rpost.Id
|
||||
post.ParentId = rpost.Id
|
||||
post.Message = "a post with @channel"
|
||||
_, resp = Client.CreatePost(post)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
post.RootId = rpost.Id
|
||||
post.ParentId = rpost.Id
|
||||
post.Message = "a post with @all"
|
||||
_, resp = Client.CreatePost(post)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
post.RootId = rpost.Id
|
||||
post.ParentId = rpost.Id
|
||||
post.Message = "a post with @here"
|
||||
_, resp = Client.CreatePost(post)
|
||||
CheckNoError(t, resp)
|
||||
})
|
||||
|
||||
post.RootId = ""
|
||||
post.ParentId = ""
|
||||
post.Type = model.POST_SYSTEM_GENERIC
|
||||
|
||||
Ссылка в новой задаче
Block a user