MM-13718 Prevent files from being attached to multiple posts (#10094)
* MM-13718 Prevent files from being attached to multiple posts * Switch back to non-batched AttachToPost * Change status code when failing to attach a file
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
f12680103a
Коммит
6325c5b569
@@ -1028,7 +1028,7 @@ func (a *App) uploadAttachments(attachments *[]AttachmentImportData, post *model
|
||||
|
||||
func (a *App) UpdateFileInfoWithPostId(post *model.Post) {
|
||||
for _, fileId := range post.FileIds {
|
||||
if result := <-a.Srv.Store.FileInfo().AttachToPost(fileId, post.Id); result.Err != nil {
|
||||
if result := <-a.Srv.Store.FileInfo().AttachToPost(fileId, post.Id, post.UserId); result.Err != nil {
|
||||
mlog.Error(fmt.Sprintf("Error attaching files to post. postId=%v, fileIds=%v, message=%v", post.Id, post.FileIds, result.Err), mlog.String("post_id", post.Id))
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user