[PLT-7362] Add post' root ID to APIv4 addChannelMember to render added user (as system post) at RHS (#7730)

* add post' root ID to apiv4 addChannelMember to render added user (as system post) at RHS

* add check to post_root_id parameter

* add AddChannelMemberWithRootId function for backward compatibility
Этот коммит содержится в:
Saturnino Abril
2017-11-01 03:48:58 +08:00
коммит произвёл Joram Wilander
родитель 3024525c3b
Коммит 709ef99eca
5 изменённых файлов: 61 добавлений и 16 удалений

Просмотреть файл

@@ -1740,6 +1740,24 @@ func TestAddChannelMember(t *testing.T) {
t.Fatal("should have returned exact user added to private channel")
}
post := &model.Post{ChannelId: publicChannel.Id, Message: "a" + GenerateTestId() + "a"}
rpost, err := Client.CreatePost(post)
if err == nil {
t.Fatal("should have created a post")
}
Client.RemoveUserFromChannel(publicChannel.Id, user.Id)
_, resp = Client.AddChannelMemberWithRootId(publicChannel.Id, user.Id, rpost.Id)
CheckNoError(t, resp)
CheckCreatedStatus(t, resp)
Client.RemoveUserFromChannel(publicChannel.Id, user.Id)
_, resp = Client.AddChannelMemberWithRootId(publicChannel.Id, user.Id, "junk")
CheckBadRequestStatus(t, resp)
_, resp = Client.AddChannelMemberWithRootId(publicChannel.Id, user.Id, GenerateTestId())
CheckNotFoundStatus(t, resp)
Client.RemoveUserFromChannel(publicChannel.Id, user.Id)
_, resp = Client.AddChannelMember(publicChannel.Id, user.Id)
CheckNoError(t, resp)