Merge pull request #9658 from overleaf/em-dropbox-folder-sync

Sync folder creation from Dropbox to Overleaf

GitOrigin-RevId: a2749ab8d9db7dd312818b46d6e72f1dbaaaff2e
This commit is contained in:
Eric Mc Sween
2022-09-21 08:01:56 -04:00
committed by Copybot
parent 59cdcccc26
commit a6307d8497
11 changed files with 257 additions and 22 deletions

View File

@@ -50,6 +50,7 @@ module.exports = {
mkdirp: callbackifyMultiResult(wrapWithLock(mkdirp), [
'newFolders',
'folder',
'parentFolder',
]),
moveEntity: callbackifyMultiResult(wrapWithLock(moveEntity), [
'project',
@@ -279,13 +280,14 @@ async function mkdirp(projectId, path, options = {}) {
for (const folderName of folders) {
builtUpPath += `/${folderName}`
try {
const { element: foundFolder } =
const { element: foundFolder, folder: parentFolder } =
await ProjectLocator.promises.findElementByPath({
project,
path: builtUpPath,
exactCaseMatch: options.exactCaseMatch,
})
lastFolder = foundFolder
lastFolder.parentFolder_id = parentFolder._id
} catch (err) {
// Folder couldn't be found. Create it.
const parentFolderId = lastFolder && lastFolder._id