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
@@ -1383,6 +1383,20 @@ func (_m *UserStore) UpdateMfaSecret(userID string, secret string) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdateNotifyProps provides a mock function with given fields: userID, props
|
||||
func (_m *UserStore) UpdateNotifyProps(userID string, props map[string]string) error {
|
||||
ret := _m.Called(userID, props)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, map[string]string) error); ok {
|
||||
r0 = rf(userID, props)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdatePassword provides a mock function with given fields: userID, newPassword
|
||||
func (_m *UserStore) UpdatePassword(userID string, newPassword string) error {
|
||||
ret := _m.Called(userID, newPassword)
|
||||
|
||||
@@ -215,6 +215,22 @@ func testUserStoreUpdate(t *testing.T, ss store.Store) {
|
||||
|
||||
err = ss.User().UpdateLastPictureUpdate(u1.Id)
|
||||
require.NoError(t, err, "Update should not have failed")
|
||||
|
||||
// Test UpdateNotifyProps
|
||||
u1, err = ss.User().Get(context.Background(), u1.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
props := u1.NotifyProps
|
||||
props["hello"] = "world"
|
||||
|
||||
err = ss.User().UpdateNotifyProps(u1.Id, props)
|
||||
require.NoError(t, err)
|
||||
|
||||
ss.User().InvalidateProfileCacheForUser(u1.Id)
|
||||
|
||||
uNew, err := ss.User().Get(context.Background(), u1.Id)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, props, uNew.NotifyProps)
|
||||
}
|
||||
|
||||
func testUserStoreUpdateUpdateAt(t *testing.T, ss store.Store) {
|
||||
|
||||
Ссылка в новой задаче
Block a user