fix user timezone initialization (#8547)

On PreSave, need to ensure TimeZone isn't left as NULL.
This commit is contained in:
Jesse Hallam
2018-03-29 14:58:18 -04:00
committed by Joram Wilander
parent 014a3b6a60
commit 0affad9c24
2 changed files with 4 additions and 1 deletions

View File

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

View File

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