From ee95e4e450444713796c22152149a8d9cd624baf Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Tue, 28 Oct 2014 09:47:49 -0700 Subject: [PATCH] Got rid of a race condition. --- server/commons/Handler.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/commons/Handler.coffee b/server/commons/Handler.coffee index bc5161465..e56111398 100644 --- a/server/commons/Handler.coffee +++ b/server/commons/Handler.coffee @@ -101,6 +101,8 @@ module.exports = class Handler get: (req, res) -> @sendForbiddenError(res) if not @hasAccess(req) + specialParameters = ['term', 'project', 'conditions'] + if @modelClass.schema.uses_coco_translation_coverage and req.query.view is 'i18n-coverage' # TODO: generalize view, project, limit and skip query parameters projection = {} @@ -123,10 +125,8 @@ module.exports = class Handler @sendSuccess(res, documents) return - specialParameters = ['term', 'project', 'conditions'] - # If the model uses coco search it's probably a text search - if @modelClass.schema.uses_coco_search + else if @modelClass.schema.uses_coco_search term = req.query.term matchedObjects = [] filters = if @modelClass.schema.uses_coco_versions or @modelClass.schema.uses_coco_permissions then [filter: {index: true}] else [filter: {}]