Poststore migration part3 (#15505)
* Migration completed * Order in translations file * Fix: lints * Trigger CI * Fix message key * Change mlog.Error for mlog.Warn * Fix imports * Adding translations needed for EE * Trigger CI * Fix merge with master Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cd7d68effb
Коммит
8118cac350
@@ -338,9 +338,9 @@ func (a *App) exportAllPosts(writer io.Writer) *model.AppError {
|
||||
afterId := strings.Repeat("0", 26)
|
||||
|
||||
for {
|
||||
posts, err := a.Srv().Store.Post().GetParentsForExportAfter(1000, afterId)
|
||||
if err != nil {
|
||||
return err
|
||||
posts, nErr := a.Srv().Store.Post().GetParentsForExportAfter(1000, afterId)
|
||||
if nErr != nil {
|
||||
return model.NewAppError("exportAllPosts", "app.post.get_posts.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if len(posts) == 0 {
|
||||
@@ -357,6 +357,7 @@ func (a *App) exportAllPosts(writer io.Writer) *model.AppError {
|
||||
|
||||
postLine := ImportLineForPost(post)
|
||||
|
||||
var err *model.AppError
|
||||
postLine.Post.Replies, err = a.buildPostReplies(post.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -380,17 +381,18 @@ func (a *App) exportAllPosts(writer io.Writer) *model.AppError {
|
||||
func (a *App) buildPostReplies(postId string) (*[]ReplyImportData, *model.AppError) {
|
||||
var replies []ReplyImportData
|
||||
|
||||
replyPosts, err := a.Srv().Store.Post().GetRepliesForExport(postId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
replyPosts, nErr := a.Srv().Store.Post().GetRepliesForExport(postId)
|
||||
if nErr != nil {
|
||||
return nil, model.NewAppError("buildPostReplies", "app.post.get_posts.app_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
for _, reply := range replyPosts {
|
||||
replyImportObject := ImportReplyFromPost(reply)
|
||||
if reply.HasReactions {
|
||||
replyImportObject.Reactions, err = a.BuildPostReactions(reply.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var appErr *model.AppError
|
||||
replyImportObject.Reactions, appErr = a.BuildPostReactions(reply.Id)
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
}
|
||||
}
|
||||
replies = append(replies, *replyImportObject)
|
||||
@@ -545,7 +547,7 @@ func (a *App) exportAllDirectPosts(writer io.Writer) *model.AppError {
|
||||
for {
|
||||
posts, err := a.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, afterId)
|
||||
if err != nil {
|
||||
return err
|
||||
return model.NewAppError("exportAllDirectPosts", "app.post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if len(posts) == 0 {
|
||||
|
||||
Ссылка в новой задаче
Block a user