MM-15864 - Made Post.GetRepliesForExport sync (#11046)

* Changed Post.GetRepliesForExport to be sync

* Removed else, and renamed err

* renamed result variable to replyPosts
Этот коммит содержится в:
Will Andrews
2019-06-06 19:29:54 +01:00
коммит произвёл Jesse Hallam
родитель 6a42ad2af5
Коммит 2d14eef6c7
5 изменённых файлов: 48 добавлений и 44 удалений

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

@@ -1293,30 +1293,29 @@ func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*m
return posts, nil
}
func (s *SqlPostStore) GetRepliesForExport(parentId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
var posts []*model.ReplyForExport
_, err1 := s.GetSearchReplica().Select(&posts, `
SELECT
Posts.*,
Users.Username as Username
FROM
Posts
INNER JOIN
Users ON Posts.UserId = Users.Id
WHERE
Posts.ParentId = :ParentId
AND Posts.DeleteAt = 0
ORDER BY
Posts.Id`,
map[string]interface{}{"ParentId": parentId})
func (s *SqlPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
if err1 != nil {
result.Err = model.NewAppError("SqlPostStore.GetAllAfterForExport", "store.sql_post.get_posts.app_error", nil, err1.Error(), http.StatusInternalServerError)
} else {
result.Data = posts
}
})
var posts []*model.ReplyForExport
_, err := s.GetSearchReplica().Select(&posts, `
SELECT
Posts.*,
Users.Username as Username
FROM
Posts
INNER JOIN
Users ON Posts.UserId = Users.Id
WHERE
Posts.ParentId = :ParentId
AND Posts.DeleteAt = 0
ORDER BY
Posts.Id`,
map[string]interface{}{"ParentId": parentId})
if err != nil {
return nil, model.NewAppError("SqlPostStore.GetAllAfterForExport", "store.sql_post.get_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return posts, nil
}
func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {