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
activate: (cb)->
InactiveProjectManager.reactivateProjectIfRequired project_id, cb
markOpened: (cb)->
ProjectUpdateHandler.markOpened project_id, cb
markAsOpened: (cb)->
#don't need to wait for this to complete
ProjectUpdateHandler.markAsOpened project_id, ->
cb()
}, (err, results)->
if err?
logger.err err:err, "error getting details for project page"

View file

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