mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02:00
Change docLabelsUpdated socket event to broadcastDocLabels
This commit is contained in:
@@ -20,7 +20,7 @@ module.exports = LabelsController =
|
||||
if err?
|
||||
logger.err {project_id, doc_id, err}, "[LabelsController] error getting labels from doc"
|
||||
return next(err)
|
||||
EditorRealTimeController.emitToRoom project_id, 'docLabelsUpdated', {
|
||||
EditorRealTimeController.emitToRoom project_id, 'broadcastDocLabels', {
|
||||
docId: doc_id, labels: docLabels
|
||||
}
|
||||
res.json {projectId: project_id, docId: doc_id, labels: docLabels}
|
||||
|
||||
@@ -128,7 +128,8 @@ define [
|
||||
ide.binaryFilesManager = new BinaryFilesManager(ide, $scope)
|
||||
|
||||
# Set up labels
|
||||
$scope.$on 'doc:labels:updated', labels.onDocLabelsUpdated
|
||||
ide.socket.on 'broadcastDocLabels', (data) ->
|
||||
labels.onBroadcastDocLabels(data)
|
||||
$scope.$on 'entity:deleted', labels.onEntityDeleted
|
||||
$scope.$on 'file:upload:complete', labels.fileUploadComplete
|
||||
$timeout () ->
|
||||
@@ -179,7 +180,4 @@ define [
|
||||
# User can append ?ft=somefeature to url to activate a feature toggle
|
||||
ide.featureToggle = location?.search?.match(/^\?ft=(\w+)$/)?[1]
|
||||
|
||||
ide.socket.on 'docLabelsUpdated', (data) ->
|
||||
$scope.$broadcast 'doc:labels:updated', data
|
||||
|
||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
||||
|
||||
@@ -10,7 +10,7 @@ define [
|
||||
state: state
|
||||
}
|
||||
|
||||
labels.onDocLabelsUpdated = (e, data) ->
|
||||
labels.onBroadcastDocLabels = (data) ->
|
||||
if data.docId and data.labels
|
||||
state.documents[data.docId] = data.labels
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ describe 'LabelsController', ->
|
||||
@EditorRealTimeController.emitToRoom.callCount.should.equal 1
|
||||
lastCall = @EditorRealTimeController.emitToRoom.lastCall
|
||||
expect(lastCall.args[0]).to.equal @projectId
|
||||
expect(lastCall.args[1]).to.equal 'docLabelsUpdated'
|
||||
expect(lastCall.args[1]).to.equal 'broadcastDocLabels'
|
||||
expect(lastCall.args[2]).to.have.all.keys ['docId', 'labels']
|
||||
|
||||
describe 'when LabelsHandler.getLabelsForDoc produces an error', ->
|
||||
|
||||
Reference in New Issue
Block a user