fixed call to ProjectUpdateHandler.markAsOpened and made it async

This commit is contained in:
Henry Oswald 2015-08-14 11:27:11 +01:00
parent 66b87df17c
commit 70b825fd2a
2 changed files with 7 additions and 5 deletions

View file

@ -193,8 +193,10 @@ module.exports = ProjectController =
SubscriptionLocator.getUsersSubscription user_id, cb SubscriptionLocator.getUsersSubscription user_id, cb
activate: (cb)-> activate: (cb)->
InactiveProjectManager.reactivateProjectIfRequired project_id, cb InactiveProjectManager.reactivateProjectIfRequired project_id, cb
markOpened: (cb)-> markAsOpened: (cb)->
ProjectUpdateHandler.markOpened project_id, cb #don't need to wait for this to complete
ProjectUpdateHandler.markAsOpened project_id, ->
cb()
}, (err, results)-> }, (err, results)->
if err? if err?
logger.err err:err, "error getting details for project page" logger.err err:err, "error getting details for project page"

View file

@ -45,7 +45,7 @@ describe "ProjectController", ->
@InactiveProjectManager = @InactiveProjectManager =
reactivateProjectIfRequired:sinon.stub() reactivateProjectIfRequired:sinon.stub()
@ProjectUpdateHandler = @ProjectUpdateHandler =
markOpened: sinon.stub() markAsOpened: sinon.stub()
@ProjectController = SandboxedModule.require modulePath, requires: @ProjectController = SandboxedModule.require modulePath, requires:
"settings-sharelatex":@settings "settings-sharelatex":@settings
"logger-sharelatex": "logger-sharelatex":
@ -289,7 +289,7 @@ describe "ProjectController", ->
@SecurityManager.userCanAccessProject.callsArgWith 2, true, "owner" @SecurityManager.userCanAccessProject.callsArgWith 2, true, "owner"
@ProjectDeleter.unmarkAsDeletedByExternalSource = sinon.stub() @ProjectDeleter.unmarkAsDeletedByExternalSource = sinon.stub()
@InactiveProjectManager.reactivateProjectIfRequired.callsArgWith(1) @InactiveProjectManager.reactivateProjectIfRequired.callsArgWith(1)
@ProjectUpdateHandler.markOpened.callsArgWith(1) @ProjectUpdateHandler.markAsOpened.callsArgWith(1)
it "should render the project/editor page", (done)-> it "should render the project/editor page", (done)->
@ -339,7 +339,7 @@ describe "ProjectController", ->
it "should mark project as opened", (done)-> it "should mark project as opened", (done)->
@res.render = (pageName, opts)=> @res.render = (pageName, opts)=>
@ProjectUpdateHandler.markOpened.calledWith(@project_id).should.equal true @ProjectUpdateHandler.markAsOpened.calledWith(@project_id).should.equal true
done() done()
@ProjectController.loadEditor @req, @res @ProjectController.loadEditor @req, @res