From 5fbec91c35d7ea5d9b920b26a01fc21da55bb08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 8 Aug 2018 12:10:05 +0200 Subject: MM-9747: Small fixes for attachments import (#9225) * MM-9747: Small fixes for attachments import * Adding unit test RootId check in replies --- app/import_functions.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app/import_functions.go') diff --git a/app/import_functions.go b/app/import_functions.go index f4ff5607f..e370099d9 100644 --- a/app/import_functions.go +++ b/app/import_functions.go @@ -763,7 +763,7 @@ func (a *App) ImportReply(data *ReplyImportData, post *model.Post, teamId string var reply *model.Post for _, r := range replies { - if r.Message == *data.Message { + if r.Message == *data.Message && r.RootId == post.Id { reply = r break } @@ -784,7 +784,7 @@ func (a *App) ImportReply(data *ReplyImportData, post *model.Post, teamId string if err != nil { return err } - reply.FileIds = fileIds + reply.FileIds = append(reply.FileIds, fileIds...) } if reply.Id == "" { @@ -820,6 +820,8 @@ func (a *App) ImportAttachment(data *AttachmentImportData, post *model.Post, tea return nil, fileUploadError } + a.HandleImages([]string{fileInfo.PreviewPath}, []string{fileInfo.ThumbnailPath}, [][]byte{buf.Bytes()}) + mlog.Info(fmt.Sprintf("uploading file with name %s", file.Name())) return fileInfo, nil } @@ -889,7 +891,7 @@ func (a *App) ImportPost(data *PostImportData, dryRun bool) *model.AppError { if err != nil { return err } - post.FileIds = fileIds + post.FileIds = append(post.FileIds, fileIds...) } if post.Id == "" { -- cgit v1.2.3-1-g7c22