summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorcpanato <ctadeu@gmail.com>2018-09-04 23:27:39 +0200
committercpanato <ctadeu@gmail.com>2018-09-04 23:27:39 +0200
commit4cf6913c1c58847b69bd7a16f046d4bfc676bdb4 (patch)
treedbad14ece2033e395eb8f93920ce7256da803f35 /store
parent50af3a19a2817097355df9fd70c0fda0328d8bae (diff)
parentd2190527eafdae31e14ba0832dcfb79a0a1e223b (diff)
downloadchat-4cf6913c1c58847b69bd7a16f046d4bfc676bdb4.tar.gz
chat-4cf6913c1c58847b69bd7a16f046d4bfc676bdb4.tar.bz2
chat-4cf6913c1c58847b69bd7a16f046d4bfc676bdb4.zip
Merge remote-tracking branch 'upstream/release-5.3' into release-5.3-daily-merge-20180904
Diffstat (limited to 'store')
-rw-r--r--store/sqlstore/channel_store.go5
-rw-r--r--store/sqlstore/upgrade.go10
-rw-r--r--store/storetest/channel_store.go6
3 files changed, 15 insertions, 6 deletions
diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go
index a09c00082..1b5ae7ff7 100644
--- a/store/sqlstore/channel_store.go
+++ b/store/sqlstore/channel_store.go
@@ -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
}
diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go
index 4d7d4addc..ad71095e1 100644
--- a/store/sqlstore/upgrade.go
+++ b/store/sqlstore/upgrade.go
@@ -484,10 +484,8 @@ func UpgradeDatabaseToVersion52(sqlStore SqlStore) {
}
func UpgradeDatabaseToVersion53(sqlStore SqlStore) {
- // TODO: Uncomment following condition when version 5.3.0 is released
- // if shouldPerformUpgrade(sqlStore, VERSION_5_2_0, VERSION_5_3_0) {
- sqlStore.AlterColumnTypeIfExists("OutgoingWebhooks", "Description", "varchar(500)", "varchar(500)")
- sqlStore.AlterColumnTypeIfExists("IncomingWebhooks", "Description", "varchar(500)", "varchar(500)")
- // saveSchemaVersion(sqlStore, VERSION_5_3_0)
- // }
+ if shouldPerformUpgrade(sqlStore, VERSION_5_2_0, VERSION_5_3_0) {
+ saveSchemaVersion(sqlStore, VERSION_5_3_0)
+ }
+
}
diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go
index 630c7abf5..776434b6e 100644
--- a/store/storetest/channel_store.go
+++ b/store/storetest/channel_store.go
@@ -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")