diff options
Diffstat (limited to 'model/user.go')
-rw-r--r-- | model/user.go | 10 |
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 |