|
|
@@ -8,16 +8,16 @@ module.exports = LabelsHandler =
|
|
|
/\\label\{([^\}\n\\]{0,80})\}/g
|
|
|
|
|
|
getAllLabelsForProject: (projectId, callback=(err, projectLabels)->) ->
|
|
|
- ProjectEntityHandler.getAllDocs projectId, (err, docs) ->
|
|
|
+ DocumentUpdaterHandler.flushProjectToMongo projectId, (err) ->
|
|
|
if err?
|
|
|
return callback(err)
|
|
|
- projectLabels = LabelsHandler.extractLabelsFromProjectDocs docs
|
|
|
- callback(null, projectLabels)
|
|
|
+ ProjectEntityHandler.getAllDocs projectId, (err, docs) ->
|
|
|
+ if err?
|
|
|
+ return callback(err)
|
|
|
+ projectLabels = LabelsHandler.extractLabelsFromProjectDocs docs
|
|
|
+ callback(null, projectLabels)
|
|
|
|
|
|
getLabelsForDoc: (projectId, docId, callback=(err, docLabels)->) ->
|
|
|
- # Flush doc first, because this action is often performed while
|
|
|
- # a document is being edited by the client. By contrast,
|
|
|
- # `getAllLabelsForProject` is called only when a project/editor is loaded
|
|
|
DocumentUpdaterHandler.flushDocToMongo projectId, docId, (err) ->
|
|
|
if err?
|
|
|
return callback(err)
|