From bf389e4dcbcaf24a1284d6b2705d3e904b41b844 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 16 Mar 2021 13:15:26 -0700 Subject: [PATCH] IO-771 Reassign documents between jobs. --- .../jobs-document-gallery.reassign.component.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx index 6d6a2f4a1..c2b7ff948 100644 --- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.reassign.component.jsx @@ -54,11 +54,20 @@ export default function JobsDocumentsGalleryReassign({ galleryImages }) { const res = await axios.post("/media/rename", { documents: selectedImages.map((i) => { - return { id: i.id, from: i.key, to: i.key.replace("null", jobid) }; + //Need to check if the current key folder is null, or another job. + const currentKeys = i.key.split("/"); + currentKeys[1] = jobid; + currentKeys.join("/"); + return { id: i.id, from: i.key, to: currentKeys.join("/") }; }), }); - console.log(res.data); + res.data + .filter((d) => d.error) + .forEach((d) => { + notification["error"]({ message: t("documents.errors.updating") }); + console.error("Error updating job document", d); + }); const proms = [];