summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-11-01 03:48:58 +0800
committerJoram Wilander <jwawilander@gmail.com>2017-10-31 15:48:58 -0400
commit709ef99eca0353585eb00c795cc36f39bac29a1f (patch)
treeea4304506cbbe6825007d75d1c5975b661d394ab /model
parent3024525c3b2ba8fb0f3f83223dd15fa721cca638 (diff)
downloadchat-709ef99eca0353585eb00c795cc36f39bac29a1f.tar.gz
chat-709ef99eca0353585eb00c795cc36f39bac29a1f.tar.bz2
chat-709ef99eca0353585eb00c795cc36f39bac29a1f.zip
[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
Diffstat (limited to 'model')
-rw-r--r--model/client4.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index bcd41638b..916e9d6de 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1663,6 +1663,17 @@ func (c *Client4) AddChannelMember(channelId, userId string) (*ChannelMember, *R
}
}
+// AddChannelMemberWithRootId adds user to channel and return a channel member. Post add to channel message has the postRootId.
+func (c *Client4) AddChannelMemberWithRootId(channelId, userId, postRootId string) (*ChannelMember, *Response) {
+ requestBody := map[string]string{"user_id": userId, "post_root_id": postRootId}
+ if r, err := c.DoApiPost(c.GetChannelMembersRoute(channelId)+"", MapToJson(requestBody)); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return ChannelMemberFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// RemoveUserFromChannel will delete the channel member object for a user, effectively removing the user from a channel.
func (c *Client4) RemoveUserFromChannel(channelId, userId string) (bool, *Response) {
if r, err := c.DoApiDelete(c.GetChannelMemberRoute(channelId, userId)); err != nil {