Migrate "Post.GetPostsByIds" to Sync by default (#11034)

Этот коммит содержится в:
GianOrtiz
2019-06-04 18:25:16 -03:00
коммит произвёл Jesse Hallam
родитель a57e042dab
Коммит b26e5d444e
6 изменённых файлов: 39 добавлений и 30 удалений

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

@@ -260,10 +260,9 @@ func AssertFileIdsInPost(files []*model.FileInfo, th *TestHelper, t *testing.T)
postId := files[0].PostId
assert.NotNil(t, postId)
if result := <-th.App.Srv.Store.Post().GetPostsByIds([]string{postId}); result.Err != nil {
t.Fatal(result.Err.Error())
if posts, err := th.App.Srv.Store.Post().GetPostsByIds([]string{postId}); err != nil {
t.Fatal(err.Error())
} else {
posts := result.Data.([]*model.Post)
assert.Equal(t, len(posts), 1)
for _, file := range files {
assert.Contains(t, posts[0].FileIds, file.Id)

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

@@ -883,11 +883,11 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
// Get the posts
postList := model.NewPostList()
if len(postIds) > 0 {
presult := <-a.Srv.Store.Post().GetPostsByIds(postIds)
if presult.Err != nil {
return nil, presult.Err
posts, err := a.Srv.Store.Post().GetPostsByIds(postIds)
if err != nil {
return nil, err
}
for _, p := range presult.Data.([]*model.Post) {
for _, p := range posts {
if p.DeleteAt == 0 {
postList.AddPost(p)
postList.AddOrder(p.Id)