Change the implementation of GetAll() in preference_store.go to ret… (#10926)

* Change the implementation of GetAll() in `preference_store.go` to return an
object from `model` and a *model.AppError.
Change the Interface in `store.go` to accomodate for the change
Change the test that called the GetAll() function

* Rename the result variable to preferences so it makes more sense.
Use assertions to keep the test consistent

* Generate the correct mocks after the code changes

* Remove redundant conditions

* Address govet errors

* Resolve conflicts with master's new changes

* Fix Save() function according to the new changes in master (Got
overwritten with the previous commit)

* Change the assertions to have the same format as commit 2d97f01
Этот коммит содержится в:
Giorgos Christos Dimitriou
2019-06-03 12:25:04 +01:00
коммит произвёл Dean Whillier
родитель d1f81842a5
Коммит 2e79ae9636
5 изменённых файлов: 58 добавлений и 53 удалений

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

@@ -10,12 +10,12 @@ import (
)
func (a *App) GetPreferencesForUser(userId string) (model.Preferences, *model.AppError) {
result := <-a.Srv.Store.Preference().GetAll(userId)
if result.Err != nil {
result.Err.StatusCode = http.StatusBadRequest
return nil, result.Err
preferences, err := a.Srv.Store.Preference().GetAll(userId)
if err != nil {
err.StatusCode = http.StatusBadRequest
return nil, err
}
return result.Data.(model.Preferences), nil
return preferences, nil
}
func (a *App) GetPreferenceByCategoryForUser(userId string, category string) (model.Preferences, *model.AppError) {