diff options
author | Santos Solorzano <santosjavier22@gmail.com> | 2017-10-12 10:54:37 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-10-12 13:54:37 -0400 |
commit | a7afadec3a2646e9bf02860d7544c58a38e33373 (patch) | |
tree | e1b18b5572e005b01041cd52db55bf779c2e9a7a /api4/channel.go | |
parent | fe410223536cd561c2e679ac635592a5af091602 (diff) | |
download | chat-a7afadec3a2646e9bf02860d7544c58a38e33373.tar.gz chat-a7afadec3a2646e9bf02860d7544c58a38e33373.tar.bz2 chat-a7afadec3a2646e9bf02860d7544c58a38e33373.zip |
Add User To Channel api route returns a 400 error when trying to add users to a DM or GM channel (#7587)
Diffstat (limited to 'api4/channel.go')
-rw-r--r-- | api4/channel.go | 5 |
1 files changed, 5 insertions, 0 deletions
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 |