summaryrefslogtreecommitdiffstats
path: root/api4/channel.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-07-05 03:17:43 -0400
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-07-05 09:17:43 +0200
commit6b7a35b653cbb3fdcd27a542c8a7faec4352d153 (patch)
tree065d3c4d425af94fa630e5f0959b94aef65fdc35 /api4/channel.go
parent7c855c30dbb0326901a9c087bedd7286dafac47f (diff)
downloadchat-6b7a35b653cbb3fdcd27a542c8a7faec4352d153.tar.gz
chat-6b7a35b653cbb3fdcd27a542c8a7faec4352d153.tar.bz2
chat-6b7a35b653cbb3fdcd27a542c8a7faec4352d153.zip
MM-11118: disallow deleting direct or group channels (#9054)
Diffstat (limited to 'api4/channel.go')
-rw-r--r--api4/channel.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/api4/channel.go b/api4/channel.go
index cb9112677..1afadf39b 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -638,6 +638,11 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ if channel.Type == model.CHANNEL_DIRECT || channel.Type == model.CHANNEL_GROUP {
+ c.Err = model.NewAppError("deleteChannel", "api.channel.delete_channel.type.invalid", nil, "", http.StatusBadRequest)
+ return
+ }
+
if channel.Type == model.CHANNEL_OPEN && !c.App.SessionHasPermissionToChannel(c.Session, channel.Id, model.PERMISSION_DELETE_PUBLIC_CHANNEL) {
c.SetPermissionError(model.PERMISSION_DELETE_PUBLIC_CHANNEL)
return