diff options
author | Wim <wim@42.be> | 2016-09-17 15:19:18 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-09-17 15:19:18 +0200 |
commit | 16ed2aca6a3da13ad7eae394028a5918b1a6e49f (patch) | |
tree | 45977475fc9bdda5b464e728562743d485023cf4 /vendor/github.com/mattermost/platform/model/user.go | |
parent | 0f530e7902f71c8f66b6b697a7d004e9f45bd9da (diff) | |
download | matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.tar.gz matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.tar.bz2 matterbridge-msglm-16ed2aca6a3da13ad7eae394028a5918b1a6e49f.zip |
Sync with mattermost 3.4.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/user.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/user.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/vendor/github.com/mattermost/platform/model/user.go b/vendor/github.com/mattermost/platform/model/user.go index bad616d7..680bc48c 100644 --- a/vendor/github.com/mattermost/platform/model/user.go +++ b/vendor/github.com/mattermost/platform/model/user.go @@ -48,6 +48,7 @@ type User struct { Locale string `json:"locale"` MfaActive bool `json:"mfa_active,omitempty"` MfaSecret string `json:"mfa_secret,omitempty"` + LastActivityAt int64 `db:"-" json:"last_activity_at,omitempty"` } // IsValid validates the user and returns an error if it isn't configured @@ -235,7 +236,6 @@ func (u *User) Sanitize(options map[string]bool) { } func (u *User) ClearNonProfileFields() { - u.UpdateAt = 0 u.Password = "" u.AuthData = new(string) *u.AuthData = "" @@ -251,6 +251,12 @@ func (u *User) ClearNonProfileFields() { u.FailedAttempts = 0 } +func (u *User) SanitizeProfile(options map[string]bool) { + u.ClearNonProfileFields() + + u.Sanitize(options) +} + func (u *User) MakeNonNil() { if u.Props == nil { u.Props = make(map[string]string) @@ -295,6 +301,24 @@ func (u *User) GetDisplayName() string { } } +func (u *User) GetDisplayNameForPreference(nameFormat string) string { + displayName := u.Username + + if nameFormat == PREFERENCE_VALUE_DISPLAY_NAME_NICKNAME { + if u.Nickname != "" { + displayName = u.Nickname + } else if fullName := u.GetFullName(); fullName != "" { + displayName = fullName + } + } else if nameFormat == PREFERENCE_VALUE_DISPLAY_NAME_FULL { + if fullName := u.GetFullName(); fullName != "" { + displayName = fullName + } + } + + return displayName +} + func IsValidUserRoles(userRoles string) bool { roles := strings.Split(userRoles, " ") |