MM-10007 Send an admin and regular WS events when a user is updated (#8588)
* Add user.DeepCopy() function * Add omit admins/non-admins to WS broadcast and use for updating users * Updates per feedback and adding unit test for ShouldSendEvent
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7987c95fcd
Коммит
283f34b9c6
@@ -96,6 +96,23 @@ type UserAuth struct {
|
||||
AuthService string `json:"auth_service,omitempty"`
|
||||
}
|
||||
|
||||
func (u *User) DeepCopy() *User {
|
||||
copyUser := *u
|
||||
if u.AuthData != nil {
|
||||
copyUser.AuthData = NewString(*u.AuthData)
|
||||
}
|
||||
if u.Props != nil {
|
||||
copyUser.Props = CopyStringMap(u.Props)
|
||||
}
|
||||
if u.NotifyProps != nil {
|
||||
copyUser.NotifyProps = CopyStringMap(u.NotifyProps)
|
||||
}
|
||||
if u.Timezone != nil {
|
||||
copyUser.Timezone = CopyStringMap(u.Timezone)
|
||||
}
|
||||
return ©User
|
||||
}
|
||||
|
||||
// IsValid validates the user and returns an error if it isn't configured
|
||||
// correctly.
|
||||
func (u *User) IsValid() *AppError {
|
||||
|
||||
Ссылка в новой задаче
Block a user