mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 11:01:56 +02:00
fix structure ordering bug
This commit is contained in:
@@ -140,9 +140,9 @@ module.exports = ProjectManager =
|
||||
project_ops_length = count
|
||||
cb(error)
|
||||
|
||||
async.each docUpdates, handleDocUpdate, (error) ->
|
||||
async.eachSeries docUpdates, handleDocUpdate, (error) ->
|
||||
return callback(error) if error?
|
||||
async.each fileUpdates, handleFileUpdate, (error) ->
|
||||
async.eachSeries fileUpdates, handleFileUpdate, (error) ->
|
||||
return callback(error) if error?
|
||||
if HistoryManager.shouldFlushHistoryOps(project_ops_length, docUpdates.length + fileUpdates.length, HistoryManager.FLUSH_PROJECT_EVERY_N_OPS)
|
||||
HistoryManager.flushProjectChangesAsync project_id
|
||||
|
||||
@@ -111,9 +111,12 @@ describe "ProjectManager", ->
|
||||
docLines: "a\nb"
|
||||
@docUpdates = [ @firstDocUpdate, @secondDocUpdate ]
|
||||
@firstFileUpdate =
|
||||
id: 2
|
||||
id: 3
|
||||
url: 'filestore.example.com/2'
|
||||
@fileUpdates = [ @firstFileUpdate ]
|
||||
@secondFileUpdate =
|
||||
id: 4
|
||||
url: 'filestore.example.com/3'
|
||||
@fileUpdates = [ @firstFileUpdate, @secondFileUpdate ]
|
||||
@ProjectHistoryRedisManager.queueAddEntity = sinon.stub().yields()
|
||||
|
||||
describe "successfully", ->
|
||||
@@ -123,18 +126,22 @@ describe "ProjectManager", ->
|
||||
it "should add the docs in the updates", ->
|
||||
firstDocUpdateWithVersion = _.extend({}, @firstDocUpdate, {version: "#{@version}.0"})
|
||||
secondDocUpdateWithVersion = _.extend({}, @secondDocUpdate, {version: "#{@version}.1"})
|
||||
@ProjectHistoryRedisManager.queueAddEntity
|
||||
@ProjectHistoryRedisManager.queueAddEntity.getCall(0)
|
||||
.calledWith(@project_id, 'doc', @firstDocUpdate.id, @user_id, firstDocUpdateWithVersion)
|
||||
.should.equal true
|
||||
@ProjectHistoryRedisManager.queueAddEntity
|
||||
@ProjectHistoryRedisManager.queueAddEntity.getCall(1)
|
||||
.calledWith(@project_id, 'doc', @secondDocUpdate.id, @user_id, secondDocUpdateWithVersion)
|
||||
.should.equal true
|
||||
|
||||
it "should add the files in the updates", ->
|
||||
firstFileUpdateWithVersion = _.extend({}, @firstFileUpdate, {version: "#{@version}.2"})
|
||||
@ProjectHistoryRedisManager.queueAddEntity
|
||||
secondFileUpdateWithVersion = _.extend({}, @secondFileUpdate, {version: "#{@version}.3"})
|
||||
@ProjectHistoryRedisManager.queueAddEntity.getCall(2)
|
||||
.calledWith(@project_id, 'file', @firstFileUpdate.id, @user_id, firstFileUpdateWithVersion)
|
||||
.should.equal true
|
||||
@ProjectHistoryRedisManager.queueAddEntity.getCall(3)
|
||||
.calledWith(@project_id, 'file', @secondFileUpdate.id, @user_id, secondFileUpdateWithVersion)
|
||||
.should.equal true
|
||||
|
||||
it "should not flush the history", ->
|
||||
@HistoryManager.flushProjectChangesAsync
|
||||
|
||||
Reference in New Issue
Block a user