removed req.session.destorys from endpoints now on the api router which are not needed

This commit is contained in:
Henry Oswald 2015-06-30 14:39:37 +01:00
parent 1cc0cbe8fc
commit 15a57f5dc4
7 changed files with 2 additions and 22 deletions

View file

@ -4,7 +4,6 @@ EditorController = require "../Editor/EditorController"
module.exports = CollaboratorsController = module.exports = CollaboratorsController =
getCollaborators: (req, res, next = (error) ->) -> getCollaborators: (req, res, next = (error) ->) ->
req.session.destroy()
ProjectGetter.getProject req.params.Project_id, { owner_ref: true, collaberator_refs: true, readOnly_refs: true}, (error, project) -> ProjectGetter.getProject req.params.Project_id, { owner_ref: true, collaberator_refs: true, readOnly_refs: true}, (error, project) ->
return next(error) if error? return next(error) if error?
ProjectGetter.populateProjectWithUsers project, (error, project) -> ProjectGetter.populateProjectWithUsers project, (error, project) ->

View file

@ -15,7 +15,6 @@ module.exports =
res.send JSON.stringify { res.send JSON.stringify {
lines: lines lines: lines
} }
req.session.destroy()
setDocument: (req, res, next = (error) ->) -> setDocument: (req, res, next = (error) ->) ->
project_id = req.params.Project_id project_id = req.params.Project_id
@ -28,7 +27,6 @@ module.exports =
return next(error) return next(error)
logger.log doc_id:doc_id, project_id:project_id, "finished receiving set document request from api (docupdater)" logger.log doc_id:doc_id, project_id:project_id, "finished receiving set document request from api (docupdater)"
res.send 200 res.send 200
req.session.destroy()

View file

@ -21,7 +21,6 @@ module.exports =
else else
logger.log user_id:user_id, filePath:filePath, projectName:projectName, "telling tpds update has been processed" logger.log user_id:user_id, filePath:filePath, projectName:projectName, "telling tpds update has been processed"
res.send 200 res.send 200
req.session.destroy()
deleteUpdate: (req, res)-> deleteUpdate: (req, res)->
@ -36,7 +35,6 @@ module.exports =
else else
logger.log user_id:user_id, filePath:filePath, projectName:projectName, "telling tpds delete has been processed" logger.log user_id:user_id, filePath:filePath, projectName:projectName, "telling tpds delete has been processed"
res.send 200 res.send 200
req.session.destroy()
# updateProjectContents and deleteProjectContents are used by GitHub. The project_id is known so we # updateProjectContents and deleteProjectContents are used by GitHub. The project_id is known so we
# can skip right ahead to creating/updating/deleting the file. These methods will not ignore noisy # can skip right ahead to creating/updating/deleting the file. These methods will not ignore noisy
@ -50,7 +48,6 @@ module.exports =
UpdateMerger.mergeUpdate project_id, path, req, source, (error) -> UpdateMerger.mergeUpdate project_id, path, req, source, (error) ->
return next(error) if error? return next(error) if error?
res.send(200) res.send(200)
req.session.destroy()
deleteProjectContents: (req, res, next = (error) ->) -> deleteProjectContents: (req, res, next = (error) ->) ->
{project_id} = req.params {project_id} = req.params
@ -60,7 +57,6 @@ module.exports =
UpdateMerger.deleteUpdate project_id, path, source, (error) -> UpdateMerger.deleteUpdate project_id, path, source, (error) ->
return next(error) if error? return next(error) if error?
res.send(200) res.send(200)
req.session.destroy()
parseParams: parseParams = (req)-> parseParams: parseParams = (req)->
path = req.params[0] path = req.params[0]

View file

@ -20,7 +20,7 @@ module.exports =
user_id = req.session.user._id user_id = req.session.user._id
UserDeleter.deleteUser user_id, (err)-> UserDeleter.deleteUser user_id, (err)->
if !err? if !err?
req.session.destroy() req.session?.destroy()
res.send(200) res.send(200)
unsubscribe: (req, res)-> unsubscribe: (req, res)->

View file

@ -9,7 +9,7 @@ module.exports = UserController =
# this is funcky as hell, we don't use the current session to get the user # this is funcky as hell, we don't use the current session to get the user
# we use the auth token, actually destroying session from the chat api request # we use the auth token, actually destroying session from the chat api request
if req.query?.auth_token? if req.query?.auth_token?
req.session.destroy() req.session?.destroy()
logger.log user: req.user, "reciving request for getting logged in users personal info" logger.log user: req.user, "reciving request for getting logged in users personal info"
return next(new Error("User is not logged in")) if !req.user? return next(new Error("User is not logged in")) if !req.user?
UserGetter.getUser req.user._id, { UserGetter.getUser req.user._id, {
@ -26,7 +26,6 @@ module.exports = UserController =
return next(error) if error? return next(error) if error?
return res.send(404) if !user? return res.send(404) if !user?
UserController.sendFormattedPersonalInfo(user, res, next) UserController.sendFormattedPersonalInfo(user, res, next)
req.session.destroy()
sendFormattedPersonalInfo: (user, res, next = (error) ->) -> sendFormattedPersonalInfo: (user, res, next = (error) ->) ->
UserController._formatPersonalInfo user, (error, info) -> UserController._formatPersonalInfo user, (error, info) ->

View file

@ -40,10 +40,3 @@ describe 'Project api controller', ->
resCode.should.equal 500 resCode.should.equal 500
done() done()
@controller.getProjectDetails @req, @res @controller.getProjectDetails @req, @res
it "should destroy the session", (done)->
@ProjectDetailsHandler.getDetails.callsArgWith(1, null, @projDetails)
@res.json = (data)=>
@req.session.destroy.called.should.equal true
done()
@controller.getProjectDetails @req, @res

View file

@ -98,8 +98,6 @@ describe 'TpdsController', ->
it "should return a success", -> it "should return a success", ->
@res.send.calledWith(200).should.equal true @res.send.calledWith(200).should.equal true
it "should clear the session", ->
@req.session.destroy.called.should.equal true
describe 'deleteProjectContents', -> describe 'deleteProjectContents', ->
beforeEach -> beforeEach ->
@ -125,6 +123,3 @@ describe 'TpdsController', ->
it "should return a success", -> it "should return a success", ->
@res.send.calledWith(200).should.equal true @res.send.calledWith(200).should.equal true
it "should clear the session", ->
@req.session.destroy.called.should.equal true