aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-06-09 13:24:29 -0400
committerGitHub <noreply@github.com>2023-06-09 13:24:29 -0400
commit8feb55cb8a6dc851f55ff4d7e612896c1045b626 (patch)
treef7a1c1a151c377fa131070f68c3434ee8e364bb3 /src/client/documents
parent3a70c915f3f2b64de72ac7cdff316184cb12db53 (diff)
parent7d9a5bc08cb8c5f72a6795aef9374eef12a7cdef (diff)
Merge pull request #172 from brown-dash/james-video-loading
Fix Image Loading
Diffstat (limited to 'src/client/documents')
-rw-r--r--src/client/documents/Documents.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 250a501e0..c1abd6e71 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -1841,9 +1841,21 @@ export namespace DocUtils {
});
}
+ /**
+ * uploadFilesToDocs will take in an array of Files, and creates documents for the
+ * new files.
+ *
+ * @param files an array of files that will be uploaded
+ * @param options options to use while uploading
+ * @returns
+ */
export async function uploadFilesToDocs(files: File[], options: DocumentOptions) {
const generatedDocuments: Doc[] = [];
- const upfiles = await Networking.UploadFilesToServer(files);
+
+ // These files do not have overwriteDocs, so we do not set the guid and let the client generate one.
+ const fileNoGuidPairs: Networking.FileGuidPair[] = files.map(file => ({file}));
+
+ const upfiles = await Networking.UploadFilesToServer(fileNoGuidPairs);
for (const {
source: { name, type },
result,
@@ -1855,7 +1867,8 @@ export namespace DocUtils {
export function uploadFileToDoc(file: File, options: DocumentOptions, overwriteDoc: Doc) {
const generatedDocuments: Doc[] = [];
- Networking.UploadFilesToServer([file]).then(upfiles => {
+ // Since this file has an overwriteDoc, we can set the client tracking guid to the overwriteDoc's guid.
+ Networking.UploadFilesToServer([{file, guid: overwriteDoc[Id]}]).then(upfiles => {
const {
source: { name, type },
result,