mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Send an empty keys array when there is no data
This commit is contained in:
parent
8492ea7d28
commit
e46901a21b
2 changed files with 5 additions and 4 deletions
|
@ -32,8 +32,8 @@ module.exports = ReferencesController =
|
|||
|
||||
_handleIndexResponse: (req, res, projectId, shouldBroadcast, data) ->
|
||||
if !data? or !data.keys?
|
||||
return res.send()
|
||||
else if shouldBroadcast
|
||||
return res.json({projectId, keys: []})
|
||||
if shouldBroadcast
|
||||
logger.log {projectId}, "emitting new references keys to connected clients"
|
||||
EditorRealTimeController.emitToRoom projectId, 'references:keys:updated', data.keys
|
||||
return res.json data
|
||||
|
|
|
@ -134,9 +134,10 @@ describe "ReferencesController", ->
|
|||
@res.sendStatus.calledWith(400).should.equal false
|
||||
done()
|
||||
|
||||
it 'should close the response', (done) ->
|
||||
it 'should send a response with an empty keys list', (done) ->
|
||||
@call () =>
|
||||
@res.send.called.should.equal true
|
||||
@res.json.called.should.equal true
|
||||
@res.json.calledWith({projectId: @projectId, keys: []}).should.equal true
|
||||
done()
|
||||
|
||||
describe 'index', ->
|
||||
|
|
Loading…
Reference in a new issue