mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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
This commit is contained in:
parent
2556fded1e
commit
c660497859
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue