Merge pull request #1437 from rgarmsen2295/plt-1086
PLT-1086 Enables the ability to rename the default channel (Town Square)
Этот коммит содержится в:
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user