MM-60480: Do not invalidate channel member cache on login (#28143)
On user login, we were aggressively clearing the channel member cache when it wasn't necessary. There is no channel membership info that is changing on a user login. Additionally, we fix some more issues with pointer passing to the cache. It's a known problem that our value passing style isn't consistent when we fetch items from cache. Sometimes we pass pointer-to-pointer, sometimes it's just a pointer. This is also the reason for https://github.com/mattermost/mattermost/pull/27830. We fix 2 such cases where we passed pointer-to-pointer but didn't handle the special case inside the cache. This time, we actually fix it in the app layer instead of the cache layer and also add a test for good measure. https://mattermost.atlassian.net/browse/MM-60480 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b6f83c8438
Коммит
d45a54a8e9
@@ -64,13 +64,13 @@ func (a *App) CheckPasswordAndAllCriteria(rctx request.CTX, user *model.User, pa
|
||||
return err
|
||||
}
|
||||
|
||||
defer a.Srv().Store().User().InvalidateProfileCacheForUser(user.Id)
|
||||
|
||||
if err := users.CheckUserPassword(user, password); err != nil {
|
||||
if passErr := a.Srv().Store().User().UpdateFailedPasswordAttempts(user.Id, user.FailedAttempts+1); passErr != nil {
|
||||
return model.NewAppError("CheckPasswordAndAllCriteria", "app.user.update_failed_pwd_attempts.app_error", nil, "", http.StatusInternalServerError).Wrap(passErr)
|
||||
}
|
||||
|
||||
a.InvalidateCacheForUser(user.Id)
|
||||
|
||||
var invErr *users.ErrInvalidPassword
|
||||
switch {
|
||||
case errors.As(err, &invErr):
|
||||
@@ -89,8 +89,6 @@ func (a *App) CheckPasswordAndAllCriteria(rctx request.CTX, user *model.User, pa
|
||||
}
|
||||
}
|
||||
|
||||
a.InvalidateCacheForUser(user.Id)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -98,8 +96,6 @@ func (a *App) CheckPasswordAndAllCriteria(rctx request.CTX, user *model.User, pa
|
||||
return model.NewAppError("CheckPasswordAndAllCriteria", "app.user.update_failed_pwd_attempts.app_error", nil, "", http.StatusInternalServerError).Wrap(passErr)
|
||||
}
|
||||
|
||||
a.InvalidateCacheForUser(user.Id)
|
||||
|
||||
if err := a.CheckUserPostflightAuthenticationCriteria(rctx, user); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user