diff options
author | Wim <wim@42.be> | 2016-08-15 18:47:31 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2016-08-15 18:47:31 +0200 |
commit | 24defcb970838133eb82f4fbbc516630fb81cae6 (patch) | |
tree | de88bd0761b08ee35d8f2ddbcb133f7899b4264d /vendor/github.com/mattermost/platform/model/user.go | |
parent | a1a11a88b334a4deb78915336def0113eec9738b (diff) | |
download | matterbridge-msglm-24defcb970838133eb82f4fbbc516630fb81cae6.tar.gz matterbridge-msglm-24defcb970838133eb82f4fbbc516630fb81cae6.tar.bz2 matterbridge-msglm-24defcb970838133eb82f4fbbc516630fb81cae6.zip |
Sync with mattermost 3.3.0
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/user.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/user.go | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/vendor/github.com/mattermost/platform/model/user.go b/vendor/github.com/mattermost/platform/model/user.go index c792f80d..bad616d7 100644 --- a/vendor/github.com/mattermost/platform/model/user.go +++ b/vendor/github.com/mattermost/platform/model/user.go @@ -16,11 +16,6 @@ import ( const ( ROLE_SYSTEM_ADMIN = "system_admin" - USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes - USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute - USER_OFFLINE = "offline" - USER_AWAY = "away" - USER_ONLINE = "online" USER_NOTIFY_ALL = "all" USER_NOTIFY_MENTION = "mention" USER_NOTIFY_NONE = "none" @@ -44,12 +39,9 @@ type User struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Roles string `json:"roles"` - LastActivityAt int64 `json:"last_activity_at,omitempty"` - LastPingAt int64 `json:"last_ping_at,omitempty"` AllowMarketing bool `json:"allow_marketing,omitempty"` Props StringMap `json:"props,omitempty"` NotifyProps StringMap `json:"notify_props,omitempty"` - ThemeProps StringMap `json:"theme_props,omitempty"` LastPasswordUpdate int64 `json:"last_password_update,omitempty"` LastPictureUpdate int64 `json:"last_picture_update,omitempty"` FailedAttempts int `json:"failed_attempts,omitempty"` @@ -106,10 +98,6 @@ func (u *User) IsValid() *AppError { return NewLocAppError("User.IsValid", "model.user.is_valid.auth_data_pwd.app_error", nil, "user_id="+u.Id) } - if len(u.ThemeProps) > 2000 { - return NewLocAppError("User.IsValid", "model.user.is_valid.theme.app_error", nil, "user_id="+u.Id) - } - return nil } @@ -179,21 +167,6 @@ func (u *User) PreUpdate() { } u.NotifyProps["mention_keys"] = strings.Join(goodKeys, ",") } - - if u.ThemeProps != nil { - colorPattern := regexp.MustCompile(`^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$`) - - // blank out any invalid theme values - for name, value := range u.ThemeProps { - if name == "image" || name == "type" || name == "codeTheme" { - continue - } - - if !colorPattern.MatchString(value) { - u.ThemeProps[name] = "#ffffff" - } - } - } } func (u *User) SetDefaultNotifications() { @@ -242,14 +215,6 @@ func (u *User) Etag(showFullName, showEmail bool) string { return Etag(u.Id, u.UpdateAt, showFullName, showEmail) } -func (u *User) IsOffline() bool { - return (GetMillis()-u.LastPingAt) > USER_OFFLINE_TIMEOUT && (GetMillis()-u.LastActivityAt) > USER_OFFLINE_TIMEOUT -} - -func (u *User) IsAway() bool { - return (GetMillis() - u.LastActivityAt) > USER_AWAY_TIMEOUT -} - // Remove any private data from the user object func (u *User) Sanitize(options map[string]bool) { u.Password = "" @@ -278,11 +243,9 @@ func (u *User) ClearNonProfileFields() { u.MfaActive = false u.MfaSecret = "" u.EmailVerified = false - u.LastPingAt = 0 u.AllowMarketing = false u.Props = StringMap{} u.NotifyProps = StringMap{} - u.ThemeProps = StringMap{} u.LastPasswordUpdate = 0 u.LastPictureUpdate = 0 u.FailedAttempts = 0 @@ -392,17 +355,6 @@ func (u *User) IsLDAPUser() bool { return false } -func (u *User) PreExport() { - u.Password = "" - u.AuthData = new(string) - *u.AuthData = "" - u.LastActivityAt = 0 - u.LastPingAt = 0 - u.LastPasswordUpdate = 0 - u.LastPictureUpdate = 0 - u.FailedAttempts = 0 -} - // UserFromJson will decode the input and return a User func UserFromJson(data io.Reader) *User { decoder := json.NewDecoder(data) @@ -461,6 +413,7 @@ var validUsernameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`) var restrictedUsernames = []string{ "all", "channel", + "matterbot", } func IsValidUsername(s string) bool { |