From a7afadec3a2646e9bf02860d7544c58a38e33373 Mon Sep 17 00:00:00 2001 From: Santos Solorzano Date: Thu, 12 Oct 2017 10:54:37 -0700 Subject: Add User To Channel api route returns a 400 error when trying to add users to a DM or GM channel (#7587) --- api4/channel.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api4/channel.go') diff --git a/api4/channel.go b/api4/channel.go index 7a1324883..07e48b46f 100644 --- a/api4/channel.go +++ b/api4/channel.go @@ -826,6 +826,11 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { return } + if channel.Type == model.CHANNEL_DIRECT || channel.Type == model.CHANNEL_GROUP { + c.Err = model.NewAppError("addUserToChannel", "api.channel.add_user_to_channel.type.app_error", nil, "", http.StatusBadRequest) + return + } + if cm, err := c.App.AddChannelMember(member.UserId, channel, c.Session.UserId); err != nil { c.Err = err return -- cgit v1.2.3-1-g7c22