Modified updateUserNotifyProps to directly update the field (#18097)
* Modified updateUserNotifyProps to directly update the field The method was only being used during import and it unnecessarily made multiple queries to the DB. Changed to a separate query that just updated the props field. https://community-daily.mattermost.com/plugins/focalboard/workspace/zyoahc9uapdn3xdptac6jb69ic?id=285b80a3-257d-41f6-8cf4-ed80ca9d92e5&v=495cdb4d-c13a-4992-8eb9-80cfee2819a4&c=e4f9a891-85d6-4886-8590-1e327f7f8b8f ```release-note NONE ``` * invalidating cache ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d181ae9262
Коммит
132f114793
22
app/user.go
22
app/user.go
@@ -1143,20 +1143,22 @@ func (a *App) UpdateUserActive(c *request.Context, userID string, active bool) *
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateUserNotifyProps(userID string, props map[string]string, sendNotifications bool) (*model.User, *model.AppError) {
|
||||
user, err := a.GetUser(userID)
|
||||
func (a *App) updateUserNotifyProps(userID string, props map[string]string) *model.AppError {
|
||||
err := a.srv.userService.UpdateUserNotifyProps(userID, props)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return appErr
|
||||
default:
|
||||
return model.NewAppError("UpdateUser", "app.user.update.finding.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
user.NotifyProps = props
|
||||
a.InvalidateCacheForUser(userID)
|
||||
a.onUserProfileChange(userID)
|
||||
|
||||
ruser, err := a.UpdateUser(user, sendNotifications)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ruser, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateMfa(activate bool, userID, token string) *model.AppError {
|
||||
|
||||
Ссылка в новой задаче
Block a user