summaryrefslogtreecommitdiffstats
path: root/api/channel.go
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2015-11-13 16:22:32 -0800
committerReed Garmsen <rgarmsen2295@gmail.com>2015-11-13 16:22:32 -0800
commiteacc06c7fc712e8b2e71c408327a449bc32c34d9 (patch)
tree62616763ec1389fdca315becb9550d1e2cf91cd2 /api/channel.go
parentf0b1adf6cfaf0f2825b514d2c5e132ebf583652b (diff)
downloadchat-eacc06c7fc712e8b2e71c408327a449bc32c34d9.tar.gz
chat-eacc06c7fc712e8b2e71c408327a449bc32c34d9.tar.bz2
chat-eacc06c7fc712e8b2e71c408327a449bc32c34d9.zip
Allow admins to change the display name for the default channel
Diffstat (limited to 'api/channel.go')
-rw-r--r--api/channel.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/api/channel.go b/api/channel.go
index 75ca9680d..99640e71a 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -205,9 +205,11 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
if oldChannel.Name == model.DEFAULT_CHANNEL {
- c.Err = model.NewAppError("updateChannel", "Cannot update the default channel "+model.DEFAULT_CHANNEL, "")
- c.Err.StatusCode = http.StatusForbidden
- return
+ if (len(channel.Name) > 0 && channel.Name != oldChannel.Name) || (len(channel.Type) > 0 && channel.Type != oldChannel.Type) {
+ c.Err = model.NewAppError("updateChannel", "Tried to perform an invalid update of the default channel "+model.DEFAULT_CHANNEL, "")
+ c.Err.StatusCode = http.StatusForbidden
+ return
+ }
}
oldChannel.Header = channel.Header