Add User To Channel api route returns a 400 error when trying to add users to a DM or GM channel (#7587)

This commit is contained in:
Santos Solorzano
2017-10-12 10:54:37 -07:00
committed by Joram Wilander
parent fe41022353
commit a7afadec3a

View File

@@ -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