Don't sanitize returned user when updating a user (#6095)

* Don't sanitize returned user when updating a user

* Use user model function for clearing private data
Этот коммит содержится в:
Joram Wilander
2017-04-19 15:38:35 -04:00
коммит произвёл Christopher Speller
родитель bc906abd66
Коммит 0b919a324a
4 изменённых файлов: 36 добавлений и 54 удалений

Просмотреть файл

@@ -67,15 +67,15 @@ type User struct {
}
type UserPatch struct {
Username *string `json:"username"`
Nickname *string `json:"nickname"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
Position *string `json:"position"`
Email *string `json:"email"`
Props *StringMap `json:"props,omitempty"`
NotifyProps *StringMap `json:"notify_props,omitempty"`
Locale *string `json:"locale"`
Username *string `json:"username"`
Nickname *string `json:"nickname"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
Position *string `json:"position"`
Email *string `json:"email"`
Props StringMap `json:"props,omitempty"`
NotifyProps StringMap `json:"notify_props,omitempty"`
Locale *string `json:"locale"`
}
// IsValid validates the user and returns an error if it isn't configured
@@ -267,11 +267,11 @@ func (u *User) Patch(patch *UserPatch) {
}
if patch.Props != nil {
u.Props = *patch.Props
u.Props = patch.Props
}
if patch.NotifyProps != nil {
u.NotifyProps = *patch.NotifyProps
u.NotifyProps = patch.NotifyProps
}
if patch.Locale != nil {