Kaynağa Gözat

Send 204 rather than redirect when leaving a project

James Allen 12 yıl önce
ebeveyn
işleme
1bcc0a4554

+ 1 - 1
services/web/app/coffee/Features/Collaborators/CollaboratorsController.coffee

@@ -19,7 +19,7 @@ module.exports = CollaboratorsController =
 			return next(new Error("User should be logged in"))
 		CollaboratorsHandler.removeUserFromProject req.params.project_id, user_id, (error) ->
 			return next(error) if error?
-			res.redirect "/project"
+			res.send 204
 
 	_formatCollaborators: (project, callback = (error, collaborators) ->) ->
 		collaborators = []

+ 2 - 2
services/web/test/UnitTests/coffee/Collaborators/CollaboratorsControllerTests.coffee

@@ -63,8 +63,8 @@ describe "CollaboratorsController", ->
 		it "should remove the logged in user from the project", ->
 			@CollaboratorsHandler.removeUserFromProject.calledWith(@project_id, @user_id)
 
-		it "should redirect to the project page", ->
-			@res.redirectedTo.should.equal "/project"
+		it "should return a success code", ->
+			@res.statusCode.should.equal 204
 
 	describe "_formatCollaborators", ->
 		beforeEach ->