Merge pull request #2991 from overleaf/msm-add-user-projection-project-controller

Added projection to User.getById() in ProjectController

GitOrigin-RevId: 9233a897414e3cda0b8c91f0b50d4ac422e0ab30
This commit is contained in:
Miguel Serrano 2020-07-16 08:48:02 +02:00 committed by Copybot
parent 6562f3003d
commit e692802690
2 changed files with 14 additions and 10 deletions

View file

@ -646,7 +646,10 @@ const ProjectController = {
if (userId == null) {
cb(null, defaultSettingsForAnonymousUser(userId))
} else {
User.findById(userId, (err, user) => {
User.findById(
userId,
'email first_name last_name referal_id signUpDate featureSwitches features refProviders alphaProgram betaProgram isAdmin ace',
(err, user) => {
// Handle case of deleted user
if (user == null) {
UserController.logout(req, res, next)
@ -655,7 +658,8 @@ const ProjectController = {
logger.log({ projectId, userId }, 'got user')
cb(err, user)
})
}
)
}
},
subscription(cb) {

View file

@ -937,7 +937,7 @@ describe('ProjectController', function() {
email: 'bob@bob.com'
}
this.ProjectGetter.getProject.callsArgWith(2, null, this.project)
this.UserModel.findById.callsArgWith(1, null, this.user)
this.UserModel.findById.callsArgWith(2, null, this.user)
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
this.AuthorizationManager.getPrivilegeLevelForProject.callsArgWith(
3,