From 8406e854aa912f3d7f9179b10356444f07e25223 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Wed, 14 Dec 2016 11:11:51 +0000 Subject: PLT-4332 Position field for Users (#4632) * Add User.Position field to store & model. * GOFMT * Add Position to user settings. * Unit tests. * Add position to profile popup. * i18n * Fix log message for invalid position. * Add Position field attribute to LDAP config. * Add Position field attribute to SAML config. * Reword empty position message. * Change Position Max Length to 35. * Better invalid position error message. * Add new fields to config.json. * Ensure position is never longer than max when displayed. * Hard limit of 64 chars with soft limit still 35 * Put field with other attributes. --- model/user.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'model/user.go') diff --git a/model/user.go b/model/user.go index 330d26d82..76c3772cb 100644 --- a/model/user.go +++ b/model/user.go @@ -37,6 +37,7 @@ type User struct { Nickname string `json:"nickname"` FirstName string `json:"first_name"` LastName string `json:"last_name"` + Position string `json:"position"` Roles string `json:"roles"` AllowMarketing bool `json:"allow_marketing,omitempty"` Props StringMap `json:"props,omitempty"` @@ -78,6 +79,10 @@ func (u *User) IsValid() *AppError { return NewLocAppError("User.IsValid", "model.user.is_valid.nickname.app_error", nil, "user_id="+u.Id) } + if utf8.RuneCountInString(u.Position) > 35 { + return NewLocAppError("User.IsValid", "model.user.is_valid.position.app_error", nil, "user_id="+u.Id) + } + if utf8.RuneCountInString(u.FirstName) > 64 { return NewLocAppError("User.IsValid", "model.user.is_valid.first_name.app_error", nil, "user_id="+u.Id) } -- cgit v1.2.3-1-g7c22