summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-07-09 17:06:04 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-07-17 15:13:31 -0400
commit9d8073328a5e971aaff6285e33e212c08b31b510 (patch)
treed8acd4d666c843064df13eb499ae666f29739865 /model
parent1c7f0be268046d2b509e23268eebcbbef78c5a24 (diff)
downloadchat-9d8073328a5e971aaff6285e33e212c08b31b510.tar.gz
chat-9d8073328a5e971aaff6285e33e212c08b31b510.tar.bz2
chat-9d8073328a5e971aaff6285e33e212c08b31b510.zip
Added FirstName and LastName fields to User object and attempt to populate them from the FullName/Nickname field
Diffstat (limited to 'model')
-rw-r--r--model/user.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/user.go b/model/user.go
index 88f8f718a..7265381fd 100644
--- a/model/user.go
+++ b/model/user.go
@@ -38,6 +38,8 @@ type User struct {
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Nickname string `json:"nickname"`
+ FirstName string `json:"first_name"`
+ LastName string `json:"last_name"`
Roles string `json:"roles"`
LastActivityAt int64 `json:"last_activity_at"`
LastPingAt int64 `json:"last_ping_at"`
@@ -86,6 +88,14 @@ func (u *User) IsValid() *AppError {
return NewAppError("User.IsValid", "Invalid nickname", "user_id="+u.Id)
}
+ if len(u.FirstName) > 64 {
+ return NewAppError("User.IsValid", "Invalid first name", "user_id="+u.Id)
+ }
+
+ if len(u.LastName) > 64 {
+ return NewAppError("User.IsValid", "Invalid last name", "user_id="+u.Id)
+ }
+
return nil
}