fix user timezone initialization (#8547)

On PreSave, need to ensure TimeZone isn't left as NULL.
Этот коммит содержится в:
Jesse Hallam
2018-03-29 14:58:18 -04:00
коммит произвёл Joram Wilander
родитель 014a3b6a60
Коммит 0affad9c24
2 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@@ -211,7 +211,7 @@ func (u *User) PreSave() {
} }
if u.Timezone == nil { if u.Timezone == nil {
u.Props = make(map[string]string) u.Timezone = make(map[string]string)
} }
if len(u.Password) > 0 { if len(u.Password) > 0 {

Просмотреть файл

@@ -36,6 +36,9 @@ func TestUserPreSave(t *testing.T) {
user := User{Password: "test"} user := User{Password: "test"}
user.PreSave() user.PreSave()
user.Etag(true, true) user.Etag(true, true)
if user.Timezone == nil {
t.Fatal("Timezone is nil")
}
} }
func TestUserPreUpdate(t *testing.T) { func TestUserPreUpdate(t *testing.T) {