From e8b8ef394b0bfb9a0798f43e282804c6b29390f8 Mon Sep 17 00:00:00 2001 From: Daniel Schalla Date: Mon, 9 Jul 2018 12:45:48 +0200 Subject: [PATCH 1/2] Blacklist System as Username (#9060) adapted tests --- model/user.go | 1 + model/user_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/model/user.go b/model/user.go index c5d6c13b67..e56f3aaed7 100644 --- a/model/user.go +++ b/model/user.go @@ -565,6 +565,7 @@ var restrictedUsernames = []string{ "all", "channel", "matterbot", + "system", } func IsValidUsername(s string) bool { diff --git a/model/user_test.go b/model/user_test.go index 645eaadff8..a1953a40d5 100644 --- a/model/user_test.go +++ b/model/user_test.go @@ -272,6 +272,7 @@ var usernames = []struct { {"spin'punch", false}, {"spin*punch", false}, {"all", false}, + {"system", false}, } func TestValidUsername(t *testing.T) { From 9470564d355c201155f6fcb123152b8ac954f812 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Tue, 10 Jul 2018 17:00:52 +0200 Subject: [PATCH 2/2] Add preparatory upgrade code for 5.2.0 (#9047) --- store/sqlstore/upgrade.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go index 868575522d..8ea44371c4 100644 --- a/store/sqlstore/upgrade.go +++ b/store/sqlstore/upgrade.go @@ -15,6 +15,7 @@ import ( ) const ( + VERSION_5_2_0 = "5.2.0" VERSION_5_1_0 = "5.1.0" VERSION_5_0_0 = "5.0.0" VERSION_4_10_0 = "4.10.0" @@ -80,6 +81,7 @@ func UpgradeDatabase(sqlStore SqlStore) { UpgradeDatabaseToVersion410(sqlStore) UpgradeDatabaseToVersion50(sqlStore) UpgradeDatabaseToVersion51(sqlStore) + UpgradeDatabaseToVersion52(sqlStore) // If the SchemaVersion is empty this this is the first time it has ran // so lets set it to the current version. @@ -470,3 +472,11 @@ func UpgradeDatabaseToVersion51(sqlStore SqlStore) { saveSchemaVersion(sqlStore, VERSION_5_1_0) } } + +func UpgradeDatabaseToVersion52(sqlStore SqlStore) { + // TODO: Uncomment following condition when version 5.2.0 is released + // if shouldPerformUpgrade(sqlStore, VERSION_5_1_0, VERSION_5_2_0) { + + // saveSchemaVersion(sqlStore, VERSION_5_2_0) + // } +}