Added an initial call to get all user preferences on page load

Этот коммит содержится в:
hmhealey
2015-10-15 15:09:40 -04:00
родитель 4b99e17140
Коммит 327b0b5a21
11 изменённых файлов: 179 добавлений и 13 удалений

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

@@ -212,3 +212,30 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreCha
return storeChannel
}
func (s SqlPreferenceStore) GetAll(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
var preferences model.Preferences
if _, err := s.GetReplica().Select(&preferences,
`SELECT
*
FROM
Preferences
WHERE
UserId = :UserId`, map[string]interface{}{"UserId": userId}); err != nil {
result.Err = model.NewAppError("SqlPreferenceStore.GetAll", "We encounted an error while finding preferences", err.Error())
} else {
result.Data = preferences
}
storeChannel <- result
close(storeChannel)
}()
return storeChannel
}