Răsfoiți Sursa

Don't call deprecated findPopulatedById in loadEditor

James Allen 10 ani în urmă
părinte
comite
76af5e5563

+ 1 - 1
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -187,7 +187,7 @@ module.exports = ProjectController =
 
 
 		async.parallel {
 		async.parallel {
 			project: (cb)->
 			project: (cb)->
-				Project.findPopulatedById project_id, cb
+				Project.findOne { _id: project_id }, cb
 			user: (cb)->
 			user: (cb)->
 				if user_id == 'openUser'
 				if user_id == 'openUser'
 					cb null, defaultSettingsForAnonymousUser(user_id)
 					cb null, defaultSettingsForAnonymousUser(user_id)

+ 2 - 8
services/web/test/UnitTests/coffee/Project/ProjectControllerTests.coffee

@@ -36,7 +36,7 @@ describe "ProjectController", ->
 		@NotificationsHandler =
 		@NotificationsHandler =
 			getUserNotifications: sinon.stub()
 			getUserNotifications: sinon.stub()
 		@ProjectModel =
 		@ProjectModel =
-			findPopulatedById: sinon.stub()
+			findOne: sinon.stub()
 		@UserModel =
 		@UserModel =
 			findById: sinon.stub()
 			findById: sinon.stub()
 		@SecurityManager =
 		@SecurityManager =
@@ -295,7 +295,7 @@ describe "ProjectController", ->
 					fontSize:"massive"
 					fontSize:"massive"
 					theme:"sexy"
 					theme:"sexy"
 				email: "bob@bob.com"
 				email: "bob@bob.com"
-			@ProjectModel.findPopulatedById.callsArgWith 1, null, @project
+			@ProjectModel.findOne.callsArgWith 1, null, @project
 			@UserModel.findById.callsArgWith(1, null, @user)
 			@UserModel.findById.callsArgWith(1, null, @user)
 			@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
 			@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
 			@SecurityManager.userCanAccessProject.callsArgWith 2, true, "owner"
 			@SecurityManager.userCanAccessProject.callsArgWith 2, true, "owner"
@@ -310,12 +310,6 @@ describe "ProjectController", ->
 				done()
 				done()
 			@ProjectController.loadEditor @req, @res
 			@ProjectController.loadEditor @req, @res
 
 
-		it "should add the project onto the opts", (done)->		
-			@res.render = (pageName, opts)=>
-				opts.project.should.equal @project
-				done()
-			@ProjectController.loadEditor @req, @res
-
 		it "should add user", (done)->
 		it "should add user", (done)->
 			@res.render = (pageName, opts)=>
 			@res.render = (pageName, opts)=>
 				opts.user.email.should.equal @user.email
 				opts.user.email.should.equal @user.email