fixed #100, if tags is not running you should be able to delete a project still

This commit is contained in:
Henry Oswald 2014-04-16 17:44:57 +01:00
parent 8795a8a921
commit 0a093b779e
3 changed files with 11 additions and 3 deletions

View file

@ -17,7 +17,7 @@ module.exports =
deleteProject: (req, res)->
project_id = req.params.Project_id
logger.log project_id:project_id, "deleting project"
logger.log project_id:project_id, "recived request to delete project"
projectDeleter.deleteProject project_id, (err)->
if err?
res.send 500

View file

@ -39,7 +39,8 @@ module.exports =
(cb)->
AutomaticSnapshotManager.unmarkProjectAsUpdated project_id, cb
(cb)->
tagsHandler.removeProjectFromAllTags project.owner_ref, project_id, cb
tagsHandler.removeProjectFromAllTags project.owner_ref, project_id, (err)->
cb() #doesn't matter if this fails or the order it happens in
(cb)->
project.collaberator_refs.forEach (collaberator_ref)->
tagsHandler.removeProjectFromAllTags collaberator_ref, project_id, ->
@ -50,4 +51,7 @@ module.exports =
cb()
(cb)->
Project.remove {_id:project_id}, cb
], callback
], (err)->
if err?
logger.err err:err, "problem deleting project"
callback(err)

View file

@ -3,6 +3,7 @@ settings = require("settings-sharelatex")
request = require("request")
logger = require("logger-sharelatex")
oneSecond = 1000
module.exports =
@ -12,6 +13,7 @@ module.exports =
uri:uri
json:
name:tag
timeout:oneSecond
logger.log user_id:user_id, project_id:project_id, tag:tag, "send delete tag to tags api"
request.del opts, callback
@ -21,6 +23,7 @@ module.exports =
uri:uri
json:
name:tag
timeout:oneSecond
logger.log user_id:user_id, project_id:project_id, tag:tag, "send add tag to tags api"
request.post opts, callback
@ -50,6 +53,7 @@ module.exports =
uri = buildUri(user_id, project_id)
opts =
uri:"#{settings.apis.tags.url}/user/#{user_id}/project/#{project_id}"
timeout:oneSecond
logger.log user_id:user_id, project_id:project_id, "removing project_id from tags"
request.del opts, callback