summaryrefslogtreecommitdiffstats
path: root/model/user.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-03-23 09:08:49 -0400
commit5fa1b3581955761bd39c310bc88b1489d963a9fc (patch)
tree25e6dd11592102807abebbb5de100f7d867005d8 /model/user.go
parent37f0e5e0ebc0595efe2c65ffb84fa096dc8c5493 (diff)
parent87762ae62eb887dfb3fd0957040919aede46f7d4 (diff)
downloadchat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.gz
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.tar.bz2
chat-5fa1b3581955761bd39c310bc88b1489d963a9fc.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/user.go')
-rw-r--r--model/user.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/user.go b/model/user.go
index 59472d8e5..c3a6ec04a 100644
--- a/model/user.go
+++ b/model/user.go
@@ -71,6 +71,7 @@ type User struct {
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
FailedAttempts int `json:"failed_attempts,omitempty"`
Locale string `json:"locale"`
+ Timezone StringMap `json:"timezone"`
MfaActive bool `json:"mfa_active,omitempty"`
MfaSecret string `json:"mfa_secret,omitempty"`
LastActivityAt int64 `db:"-" json:"last_activity_at,omitempty"`
@@ -86,6 +87,7 @@ type UserPatch struct {
Props StringMap `json:"props,omitempty"`
NotifyProps StringMap `json:"notify_props,omitempty"`
Locale *string `json:"locale"`
+ Timezone StringMap `json:"timezone"`
}
type UserAuth struct {
@@ -208,6 +210,10 @@ func (u *User) PreSave() {
u.SetDefaultNotifications()
}
+ if u.Timezone == nil {
+ u.Props = make(map[string]string)
+ }
+
if len(u.Password) > 0 {
u.Password = HashPassword(u.Password)
}
@@ -302,6 +308,10 @@ func (u *User) Patch(patch *UserPatch) {
if patch.Locale != nil {
u.Locale = *patch.Locale
}
+
+ if patch.Timezone != nil {
+ u.Timezone = patch.Timezone
+ }
}
// ToJson convert a User to a json string