From 7a3cf112c526cf8832d5a044ac590fb6c7ff8686 Mon Sep 17 00:00:00 2001 From: Pradeep Murugesan Date: Wed, 29 Aug 2018 14:27:44 +0200 Subject: 9304 added the attachments import to direct post (#9308) --- app/import_functions.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/import_functions.go') diff --git a/app/import_functions.go b/app/import_functions.go index e370099d9..1490dc6fa 100644 --- a/app/import_functions.go +++ b/app/import_functions.go @@ -1118,6 +1118,14 @@ func (a *App) ImportDirectPost(data *DirectPostImportData, dryRun bool) *model.A post.Hashtags, _ = model.ParseHashtags(post.Message) + if data.Attachments != nil { + fileIds, err := a.uploadAttachments(data.Attachments, post, "noteam", dryRun) + if err != nil { + return err + } + post.FileIds = append(post.FileIds, fileIds...) + } + if post.Id == "" { if result := <-a.Srv.Store.Post().Save(post); result.Err != nil { return result.Err @@ -1171,6 +1179,7 @@ func (a *App) ImportDirectPost(data *DirectPostImportData, dryRun bool) *model.A } } + a.UpdateFileInfoWithPostId(post) return nil } -- cgit v1.2.3-1-g7c22