Send user updated websocket event on plugin.UpdateUser (#16604)

* Send user updated websocket event on plugin.UpdateUser

* Changes from review
Этот коммит содержится в:
Chetanya Kandhari
2021-02-04 10:19:32 +05:30
коммит произвёл GitHub
родитель e77a3923c9
Коммит 78ccf8a775
4 изменённых файлов: 7 добавлений и 10 удалений

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

@@ -1174,8 +1174,6 @@ func (a *App) UpdateUserAsUser(user *model.User, asAdmin bool) (*model.User, *mo
return nil, err
}
a.sendUpdatedUserEvent(*updatedUser)
return updatedUser, nil
}
@@ -1192,8 +1190,6 @@ func (a *App) PatchUser(userId string, patch *model.UserPatch, asAdmin bool) (*m
return nil, err
}
a.sendUpdatedUserEvent(*updatedUser)
return updatedUser, nil
}
@@ -1311,6 +1307,7 @@ func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User,
}
})
}
a.sendUpdatedUserEvent(*userUpdate.New)
}
a.InvalidateCacheForUser(user.Id)
@@ -1331,7 +1328,7 @@ func (a *App) UpdateUserActive(userId string, active bool) *model.AppError {
return nil
}
func (a *App) UpdateUserNotifyProps(userId string, props map[string]string) (*model.User, *model.AppError) {
func (a *App) UpdateUserNotifyProps(userId string, props map[string]string, sendNotifications bool) (*model.User, *model.AppError) {
user, err := a.GetUser(userId)
if err != nil {
return nil, err
@@ -1339,7 +1336,7 @@ func (a *App) UpdateUserNotifyProps(userId string, props map[string]string) (*mo
user.NotifyProps = props
ruser, err := a.UpdateUser(user, true)
ruser, err := a.UpdateUser(user, sendNotifications)
if err != nil {
return nil, err
}