Merge pull request #1437 from rgarmsen2295/plt-1086

PLT-1086 Enables the ability to rename the default channel (Town Square)
Этот коммит содержится в:
Harrison Healey
2015-11-16 15:26:09 -05:00
родитель 48d2f86b90 1874a16666
Коммит 51f59ec869
6 изменённых файлов: 94 добавлений и 69 удалений

Просмотреть файл

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

Просмотреть файл

@@ -215,8 +215,9 @@ func TestUpdateChannel(t *testing.T) {
for _, c := range data.Channels {
if c.Name == model.DEFAULT_CHANNEL {
c.Header = "new header"
c.Name = "pseudo-square"
if _, err := Client.UpdateChannel(c); err == nil {
t.Fatal("should have errored on updating default channel")
t.Fatal("should have errored on updating default channel name")
}
break
}