From 9f9468d0e0bdf1ac83c2f709911b4ee37da757f5 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 12 Jun 2017 11:37:05 +0100 Subject: [PATCH] Use lowercase `project_id` --- .../app/coffee/Features/Labels/LabelsController.coffee | 4 ++-- services/web/app/coffee/router.coffee | 4 ++-- .../UnitTests/coffee/Labels/LabelsControllerTests.coffee | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/web/app/coffee/Features/Labels/LabelsController.coffee b/services/web/app/coffee/Features/Labels/LabelsController.coffee index a2783b4c3b..40f4081da0 100644 --- a/services/web/app/coffee/Features/Labels/LabelsController.coffee +++ b/services/web/app/coffee/Features/Labels/LabelsController.coffee @@ -6,7 +6,7 @@ logger = require 'logger-sharelatex' module.exports = LabelsController = getAllLabels: (req, res, next) -> - project_id = req.params.Project_id + project_id = req.params.project_id LabelsHandler.getAllLabelsForProject project_id, (err, projectLabels) -> if err? logger.err {project_id, err}, "[LabelsController] error getting all labels from project" @@ -14,7 +14,7 @@ module.exports = LabelsController = res.json {projectId: project_id, projectLabels: projectLabels} getLabelsForDoc: (req, res, next) -> - project_id = req.params.Project_id + project_id = req.params.project_id doc_id = req.params.doc_id LabelsHandler.getLabelsForDoc project_id, doc_id, (err, docLabels) -> if err? diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 864d6c5855..e3d66b55ff 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -194,8 +194,8 @@ module.exports = class Router webRouter.get '/Project/:Project_id/download/zip', AuthorizationMiddlewear.ensureUserCanReadProject, ProjectDownloadsController.downloadProject webRouter.get '/project/download/zip', AuthorizationMiddlewear.ensureUserCanReadMultipleProjects, ProjectDownloadsController.downloadMultipleProjects - webRouter.get '/project/:Project_id/labels', AuthorizationMiddlewear.ensureUserCanReadProject, AuthenticationController.requireLogin(), LabelsController.getAllLabels - webRouter.get '/project/:Project_id/:doc_id/labels', AuthorizationMiddlewear.ensureUserCanReadProject, AuthenticationController.requireLogin(), LabelsController.getLabelsForDoc + webRouter.get '/project/:project_id/labels', AuthorizationMiddlewear.ensureUserCanReadProject, AuthenticationController.requireLogin(), LabelsController.getAllLabels + webRouter.get '/project/:project_id/:doc_id/labels', AuthorizationMiddlewear.ensureUserCanReadProject, AuthenticationController.requireLogin(), LabelsController.getLabelsForDoc webRouter.get '/tag', AuthenticationController.requireLogin(), TagsController.getAllTags webRouter.post '/tag', AuthenticationController.requireLogin(), TagsController.createTag diff --git a/services/web/test/UnitTests/coffee/Labels/LabelsControllerTests.coffee b/services/web/test/UnitTests/coffee/Labels/LabelsControllerTests.coffee index e5e9e20132..af19dceb38 100644 --- a/services/web/test/UnitTests/coffee/Labels/LabelsControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Labels/LabelsControllerTests.coffee @@ -25,7 +25,7 @@ describe 'LabelsController', -> beforeEach -> @fakeLabels = {'somedoc': ['a_label']} @LabelsHandler.getAllLabelsForProject = sinon.stub().callsArgWith(1, null, @fakeLabels) - @req = {params: {Project_id: @projectId}} + @req = {params: {project_id: @projectId}} @res = {json: sinon.stub()} @next = sinon.stub() @@ -46,7 +46,7 @@ describe 'LabelsController', -> describe 'when LabelsHandler.getAllLabelsForProject produces an error', -> beforeEach -> @LabelsHandler.getAllLabelsForProject = sinon.stub().callsArgWith(1, new Error('woops')) - @req = {params: {Project_id: @projectId}} + @req = {params: {project_id: @projectId}} @res = {json: sinon.stub()} @next = sinon.stub() @@ -69,7 +69,7 @@ describe 'LabelsController', -> @LabelsHandler.getLabelsForDoc = sinon.stub().callsArgWith(2, null, @fakeLabels) @EditorRealTimeController.emitToRoom = sinon.stub() @docId = 'somedoc' - @req = {params: {Project_id: @projectId, doc_id: @docId}} + @req = {params: {project_id: @projectId, doc_id: @docId}} @res = {json: sinon.stub()} @next = sinon.stub() @@ -100,7 +100,7 @@ describe 'LabelsController', -> @LabelsHandler.getLabelsForDoc = sinon.stub().callsArgWith(2, new Error('woops')) @EditorRealTimeController.emitToRoom = sinon.stub() @docId = 'somedoc' - @req = {params: {Project_id: @projectId, doc_id: @docId}} + @req = {params: {project_id: @projectId, doc_id: @docId}} @res = {json: sinon.stub()} @next = sinon.stub()