From 709ef99eca0353585eb00c795cc36f39bac29a1f Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Wed, 1 Nov 2017 03:48:58 +0800 Subject: [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 --- api4/channel_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'api4/channel_test.go') diff --git a/api4/channel_test.go b/api4/channel_test.go index af47aca95..d341837c8 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -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) -- cgit v1.2.3-1-g7c22