MM-11728: Avoid Archived channels editions throught Patch (#9335)
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
9f46512759
Коммит
72560311a2
@@ -5006,6 +5006,10 @@
|
||||
"id": "store.sql_channel.update.app_error",
|
||||
"translation": "We couldn't update the channel"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_channel.update.archived_channel.app_error",
|
||||
"translation": "You can not modify an archived channel"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_channel.update.exists.app_error",
|
||||
"translation": "A channel with that handle already exists"
|
||||
|
||||
@@ -463,6 +463,11 @@ func (s SqlChannelStore) Update(channel *model.Channel) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
channel.PreUpdate()
|
||||
|
||||
if channel.DeleteAt != 0 {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Update", "store.sql_channel.update.archived_channel.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if result.Err = channel.IsValid(); result.Err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -220,6 +220,12 @@ func testChannelStoreUpdate(t *testing.T, ss store.Store) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
o1.DeleteAt = 100
|
||||
if err := (<-ss.Channel().Update(&o1)).Err; err == nil {
|
||||
t.Fatal("Update should have failed because channel is archived")
|
||||
}
|
||||
|
||||
o1.DeleteAt = 0
|
||||
o1.Id = "missing"
|
||||
if err := (<-ss.Channel().Update(&o1)).Err; err == nil {
|
||||
t.Fatal("Update should have failed because of missing key")
|
||||
|
||||
Ссылка в новой задаче
Block a user