mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Push ops into uncompressedHistoryOps list
This commit is contained in:
parent
6f19f46d96
commit
b13f70eadb
4 changed files with 25 additions and 4 deletions
|
@ -103,7 +103,7 @@ module.exports = (grunt) ->
|
|||
|
||||
grunt.registerTask 'install', "Compile everything when installing as an npm module", ['compile']
|
||||
|
||||
grunt.registerTask 'test:unit', 'Run the unit tests (use --grep=<regex> for individual tests)', ['compile:unit_tests', 'mochaTest:unit']
|
||||
grunt.registerTask 'test:unit', 'Run the unit tests (use --grep=<regex> for individual tests)', ['compile:server', 'compile:unit_tests', 'mochaTest:unit']
|
||||
grunt.registerTask 'test:acceptance', 'Run the acceptance tests (use --grep=<regex> for individual tests)', ['compile:acceptance_tests', 'mochaTest:acceptance']
|
||||
|
||||
grunt.registerTask 'run', "Compile and run the document-updater-sharelatex server", ['compile', 'bunyan', 'execute']
|
||||
|
|
|
@ -44,8 +44,9 @@ module.exports = DocOpsManager =
|
|||
callback null, ops
|
||||
|
||||
pushDocOp: (project_id, doc_id, op, callback = (error) ->) ->
|
||||
console.log "PUSHING OP", op
|
||||
RedisManager.pushDocOp doc_id, op, callback
|
||||
RedisManager.pushDocOp doc_id, op, (error) ->
|
||||
return callback(error) if error?
|
||||
RedisManager.pushUncompressedHistoryOp doc_id, op, callback
|
||||
|
||||
_ensureOpsAreLoaded: (project_id, doc_id, backToVersion, callback = (error) ->) ->
|
||||
RedisManager.getDocVersion doc_id, (error, redisVersion) ->
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = ShareJsDB =
|
|||
|
||||
writeOp: (doc_key, opData, callback) ->
|
||||
[project_id, doc_id] = Keys.splitProjectIdAndDocId(doc_key)
|
||||
DocOpsManager.pushDocOp project_id, doc_id, {op:opData.op, meta:opData.meta}, (error, version) ->
|
||||
DocOpsManager.pushDocOp project_id, doc_id, opData, (error, version) ->
|
||||
return callback error if error?
|
||||
|
||||
if version == opData.v + 1
|
||||
|
|
|
@ -306,4 +306,24 @@ describe "DocOpsManager", ->
|
|||
it "should return the ops", ->
|
||||
@callback.calledWith(null, @doc.docOps).should.equal true
|
||||
|
||||
describe "pushDocOp", ->
|
||||
beforeEach ->
|
||||
@op = "mock-op"
|
||||
@RedisManager.pushDocOp = sinon.stub().callsArg(2)
|
||||
@RedisManager.pushUncompressedHistoryOp = sinon.stub().callsArg(2)
|
||||
@DocOpsManager.pushDocOp @project_id, @doc_id, @op, @callback
|
||||
|
||||
it "should push the op in to the docOps list", ->
|
||||
@RedisManager.pushDocOp
|
||||
.calledWith(@doc_id, @op)
|
||||
.should.equal true
|
||||
|
||||
it "should push the op into the pushUncompressedHistoryOp", ->
|
||||
@RedisManager.pushUncompressedHistoryOp
|
||||
.calledWith(@doc_id, @op)
|
||||
.should.equal true
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.called.should.equal true
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue