XYZ-32: Increases size of position to 128 characters. (#8148)
* XYZ-32: Changes type of 'position' column on 'users' table. * XYZ-32: Uncomment to run on CI and pre-release. * XYZ-32: Reverts translation changes. * XYZ-32: Fix for gofmt.
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
3da2dad989
Коммит
540dd9ae94
@@ -405,7 +405,7 @@ func TestImportValidateUserImportData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
data.LastName = ptrStr("Blob")
|
data.LastName = ptrStr("Blob")
|
||||||
|
|
||||||
data.Position = ptrStr(strings.Repeat("abcdefghij", 7))
|
data.Position = ptrStr(strings.Repeat("abcdefghij", 13))
|
||||||
if err := validateUserImportData(&data); err == nil {
|
if err := validateUserImportData(&data); err == nil {
|
||||||
t.Fatal("Validation should have failed due to too long Position.")
|
t.Fatal("Validation should have failed due to too long Position.")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5404,7 +5404,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "model.user.is_valid.position.app_error",
|
"id": "model.user.is_valid.position.app_error",
|
||||||
"translation": "Invalid position: must not be longer than 35 characters."
|
"translation": "Invalid position: must not be longer than 128 characters."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "model.user.is_valid.pwd.app_error",
|
"id": "model.user.is_valid.pwd.app_error",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const (
|
|||||||
|
|
||||||
USER_EMAIL_MAX_LENGTH = 128
|
USER_EMAIL_MAX_LENGTH = 128
|
||||||
USER_NICKNAME_MAX_RUNES = 64
|
USER_NICKNAME_MAX_RUNES = 64
|
||||||
USER_POSITION_MAX_RUNES = 64
|
USER_POSITION_MAX_RUNES = 128
|
||||||
USER_FIRST_NAME_MAX_RUNES = 64
|
USER_FIRST_NAME_MAX_RUNES = 64
|
||||||
USER_LAST_NAME_MAX_RUNES = 64
|
USER_LAST_NAME_MAX_RUNES = 64
|
||||||
USER_AUTH_DATA_MAX_LENGTH = 128
|
USER_AUTH_DATA_MAX_LENGTH = 128
|
||||||
|
|||||||
@@ -132,12 +132,12 @@ func TestUserIsValid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.LastName = strings.Repeat("a", 64)
|
user.LastName = strings.Repeat("a", 64)
|
||||||
user.Position = strings.Repeat("a", 64)
|
user.Position = strings.Repeat("a", 128)
|
||||||
if err := user.IsValid(); err != nil {
|
if err := user.IsValid(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
user.Position = strings.Repeat("a", 65)
|
user.Position = strings.Repeat("a", 129)
|
||||||
if err := user.IsValid(); !HasExpectedUserIsValidError(err, "position", user.Id) {
|
if err := user.IsValid(); !HasExpectedUserIsValidError(err, "position", user.Id) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
VERSION_4_7_0 = "4.7.0"
|
||||||
VERSION_4_6_0 = "4.6.0"
|
VERSION_4_6_0 = "4.6.0"
|
||||||
VERSION_4_5_0 = "4.5.0"
|
VERSION_4_5_0 = "4.5.0"
|
||||||
VERSION_4_4_0 = "4.4.0"
|
VERSION_4_4_0 = "4.4.0"
|
||||||
@@ -62,6 +63,7 @@ func UpgradeDatabase(sqlStore SqlStore) {
|
|||||||
UpgradeDatabaseToVersion44(sqlStore)
|
UpgradeDatabaseToVersion44(sqlStore)
|
||||||
UpgradeDatabaseToVersion45(sqlStore)
|
UpgradeDatabaseToVersion45(sqlStore)
|
||||||
UpgradeDatabaseToVersion46(sqlStore)
|
UpgradeDatabaseToVersion46(sqlStore)
|
||||||
|
UpgradeDatabaseToVersion47(sqlStore)
|
||||||
|
|
||||||
// If the SchemaVersion is empty this this is the first time it has ran
|
// If the SchemaVersion is empty this this is the first time it has ran
|
||||||
// so lets set it to the current version.
|
// so lets set it to the current version.
|
||||||
@@ -324,8 +326,13 @@ func UpgradeDatabaseToVersion44(sqlStore SqlStore) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpgradeDatabaseToVersion46(sqlStore SqlStore) {
|
func UpgradeDatabaseToVersion45(sqlStore SqlStore) {
|
||||||
|
if shouldPerformUpgrade(sqlStore, VERSION_4_4_0, VERSION_4_5_0) {
|
||||||
|
saveSchemaVersion(sqlStore, VERSION_4_5_0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpgradeDatabaseToVersion46(sqlStore SqlStore) {
|
||||||
if shouldPerformUpgrade(sqlStore, VERSION_4_5_0, VERSION_4_6_0) {
|
if shouldPerformUpgrade(sqlStore, VERSION_4_5_0, VERSION_4_6_0) {
|
||||||
sqlStore.CreateColumnIfNotExists("IncomingWebhooks", "Username", "varchar(64)", "varchar(64)", "")
|
sqlStore.CreateColumnIfNotExists("IncomingWebhooks", "Username", "varchar(64)", "varchar(64)", "")
|
||||||
sqlStore.CreateColumnIfNotExists("IncomingWebhooks", "IconURL", "varchar(1024)", "varchar(1024)", "")
|
sqlStore.CreateColumnIfNotExists("IncomingWebhooks", "IconURL", "varchar(1024)", "varchar(1024)", "")
|
||||||
@@ -333,8 +340,9 @@ func UpgradeDatabaseToVersion46(sqlStore SqlStore) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpgradeDatabaseToVersion45(sqlStore SqlStore) {
|
func UpgradeDatabaseToVersion47(sqlStore SqlStore) {
|
||||||
if shouldPerformUpgrade(sqlStore, VERSION_4_4_0, VERSION_4_5_0) {
|
// if shouldPerformUpgrade(sqlStore, VERSION_4_6_0, VERSION_4_7_0) {
|
||||||
saveSchemaVersion(sqlStore, VERSION_4_5_0)
|
sqlStore.AlterColumnTypeIfExists("Users", "Position", "varchar(128)", "varchar(128)")
|
||||||
}
|
// saveSchemaVersion(sqlStore, VERSION_4_7_0)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func NewSqlUserStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) st
|
|||||||
table.ColMap("NotifyProps").SetMaxSize(2000)
|
table.ColMap("NotifyProps").SetMaxSize(2000)
|
||||||
table.ColMap("Locale").SetMaxSize(5)
|
table.ColMap("Locale").SetMaxSize(5)
|
||||||
table.ColMap("MfaSecret").SetMaxSize(128)
|
table.ColMap("MfaSecret").SetMaxSize(128)
|
||||||
table.ColMap("Position").SetMaxSize(64)
|
table.ColMap("Position").SetMaxSize(128)
|
||||||
}
|
}
|
||||||
|
|
||||||
return us
|
return us
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user