diff options
author | Chris Duarte <csduarte@users.noreply.github.com> | 2018-03-29 20:50:24 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-03-29 23:50:24 -0400 |
commit | 80b3d14b56d685618c745fb6614bda93f59c18e5 (patch) | |
tree | 208e1a3652bc37f6800360c69bfd904cf8931195 /model | |
parent | 59606791a7b18b0a80626d5ec7f05b90b51c779d (diff) | |
download | chat-80b3d14b56d685618c745fb6614bda93f59c18e5.tar.gz chat-80b3d14b56d685618c745fb6614bda93f59c18e5.tar.bz2 chat-80b3d14b56d685618c745fb6614bda93f59c18e5.zip |
Initialize timezone to a default state (#8560)
Diffstat (limited to 'model')
-rw-r--r-- | model/user.go | 2 | ||||
-rw-r--r-- | model/user_test.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/model/user.go b/model/user.go index 066ea5fd2..efe8f8db9 100644 --- a/model/user.go +++ b/model/user.go @@ -211,7 +211,7 @@ func (u *User) PreSave() { } if u.Timezone == nil { - u.Timezone = make(map[string]string) + u.Timezone = DefaultUserTimezone() } if len(u.Password) > 0 { diff --git a/model/user_test.go b/model/user_test.go index 4ef59f748..c1d1dafbd 100644 --- a/model/user_test.go +++ b/model/user_test.go @@ -39,6 +39,10 @@ func TestUserPreSave(t *testing.T) { if user.Timezone == nil { t.Fatal("Timezone is nil") } + + if user.Timezone["useAutomaticTimezone"] != "true" { + t.Fatal("Timezone is not set to default") + } } func TestUserPreUpdate(t *testing.T) { |