[MM-16653] Migrate "User.UpdateUpdateAt" to Sync by default (#11517)

* Migrate "User.UpdateUpdateAt" to Sync by default

* Fixed errors in app/team.go that prevented successful build

* Reverted some changes in user_store test that caused errors in pipeline

* return of UpdateUpdateAt changed to model.AppError

* Ensured that UpdateUpdateAt in sqlstore/user_store.go returns int64 and *model.AppError, adjusted tests accordingly

* Generated mocks and ensured storetest/user_store.go had no errors

* Added require.Nil(t, err) to proper places in tests

* Added 'err' for second return value as opposed to _ in 4 UpdateUpdateAt() occurrences in storetest/user_store.go
Этот коммит содержится в:
Luke P
2019-07-08 13:14:40 -05:00
коммит произвёл Jesús Espino
родитель 797d1dc40f
Коммит 2e48b6ef3f
5 изменённых файлов: 33 добавлений и 25 удалений

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

@@ -232,17 +232,14 @@ func (us SqlUserStore) ResetLastPictureUpdate(userId string) *model.AppError {
return nil
}
func (us SqlUserStore) UpdateUpdateAt(userId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
curTime := model.GetMillis()
func (us SqlUserStore) UpdateUpdateAt(userId string) (int64, *model.AppError) {
curTime := model.GetMillis()
if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
result.Err = model.NewAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_update.app_error", nil, "user_id="+userId, http.StatusInternalServerError)
return
}
if _, err := us.GetMaster().Exec("UPDATE Users SET UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
return curTime, model.NewAppError("SqlUserStore.UpdateUpdateAt", "store.sql_user.update_update.app_error", nil, "user_id="+userId, http.StatusInternalServerError)
}
result.Data = curTime
})
return curTime, nil
}
func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) store.StoreChannel {