From c660497859852aafa02e0d2f8bd6094618b4312f Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 15 Jul 2020 09:49:23 +0100 Subject: [PATCH] Merge pull request #3008 from overleaf/as-sd-undelete-to-user Add endpoint to allow undeleted project to be assigned to a user GitOrigin-RevId: 884af4abfa19c82296f83e792319458909d23b3c --- services/web/app/src/Features/Project/ProjectDeleter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/Features/Project/ProjectDeleter.js b/services/web/app/src/Features/Project/ProjectDeleter.js index 3af65cb34d..b8c0c5d3ed 100644 --- a/services/web/app/src/Features/Project/ProjectDeleter.js +++ b/services/web/app/src/Features/Project/ProjectDeleter.js @@ -260,7 +260,7 @@ async function deleteProject(projectId, options = {}) { logger.log({ project_id: projectId }, 'successfully deleted project') } -async function undeleteProject(projectId) { +async function undeleteProject(projectId, options = {}) { let deletedProject = await DeletedProject.findOne({ 'deleterData.deletedProjectId': projectId }).exec() @@ -275,6 +275,10 @@ async function undeleteProject(projectId) { let restored = new Project(deletedProject.project) + if (options.userId) { + restored.owner_ref = options.userId + } + // if we're undeleting, we want the document to show up restored.name = await ProjectDetailsHandler.promises.generateUniqueName( deletedProject.deleterData.deletedProjectOwnerId,