diff --git a/api4/channel.go b/api4/channel.go index 7a1324883e..07e48b46fa 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