Merge pull request #2965 from overleaf/cmg-ns-no-question-mark-create-project

Specify owner when creating new project

GitOrigin-RevId: cf0505767a3eabbbbf7c6a429ee449c5dad14e4c
This commit is contained in:
Chrystal Maria Griffiths 2020-07-01 10:08:53 +01:00 committed by Copybot
parent 0da739fdc4
commit b1b0d54285
2 changed files with 18 additions and 5 deletions

View file

@ -278,7 +278,13 @@ const ProjectController = {
},
newProject(req, res, next) {
const userId = AuthenticationController.getLoggedInUserId(req)
const currentUser = AuthenticationController.getSessionUser(req)
const {
first_name: firstName,
last_name: lastName,
email,
_id: userId
} = currentUser
const projectName =
req.body.projectName != null ? req.body.projectName.trim() : undefined
const { template } = req.body
@ -297,7 +303,16 @@ const ProjectController = {
if (err != null) {
return next(err)
}
res.send({ project_id: project._id })
res.send({
project_id: project._id,
owner_ref: project.owner_ref,
owner: {
first_name: firstName,
last_name: lastName,
email,
_id: userId
}
})
}
)
},

View file

@ -446,9 +446,7 @@ App.controller('ProjectPageController', function(
name,
_id: data.project_id,
accessLevel: 'owner',
owner: {
_id: window.user_id
}
owner: data.owner
// TODO: Check access level if correct after adding it in
// to the rest of the app
})