mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
remove unecessary method wrapping
This commit is contained in:
@@ -5,9 +5,6 @@ HistoryRedisManager = require "./HistoryRedisManager"
|
||||
|
||||
module.exports = HistoryManager =
|
||||
flushDocChangesAsync: (project_id, doc_id) ->
|
||||
HistoryManager._flushDocChangesAsync project_id, doc_id
|
||||
|
||||
_flushDocChangesAsync: (project_id, doc_id) ->
|
||||
if !Settings.apis?.trackchanges?
|
||||
logger.warn { doc_id }, "track changes API is not configured, so not flushing"
|
||||
return
|
||||
@@ -51,7 +48,7 @@ module.exports = HistoryManager =
|
||||
# Do this in the background since it uses HTTP and so may be too
|
||||
# slow to wait for when processing a doc update.
|
||||
logger.log { doc_ops_length, doc_id, project_id }, "flushing track changes api"
|
||||
HistoryManager._flushDocChangesAsync project_id, doc_id
|
||||
HistoryManager.flushDocChangesAsync project_id, doc_id
|
||||
callback()
|
||||
|
||||
shouldFlushHistoryOps: (length, ops_length, threshold) ->
|
||||
|
||||
+7
-7
@@ -21,11 +21,11 @@ describe "HistoryManager", ->
|
||||
@doc_id = "mock-doc-id"
|
||||
@callback = sinon.stub()
|
||||
|
||||
describe "_flushDocChangesAsync", ->
|
||||
describe "flushDocChangesAsync", ->
|
||||
beforeEach ->
|
||||
@request.post = sinon.stub().callsArgWith(1, null, statusCode: 204)
|
||||
|
||||
@HistoryManager._flushDocChangesAsync @project_id, @doc_id
|
||||
@HistoryManager.flushDocChangesAsync @project_id, @doc_id
|
||||
|
||||
it "should send a request to the track changes api", ->
|
||||
@request.post
|
||||
@@ -51,7 +51,7 @@ describe "HistoryManager", ->
|
||||
|
||||
@HistoryManager.flushProjectChangesAsync = sinon.stub()
|
||||
@HistoryRedisManager.recordDocHasHistoryOps = sinon.stub().callsArg(3)
|
||||
@HistoryManager._flushDocChangesAsync = sinon.stub()
|
||||
@HistoryManager.flushDocChangesAsync = sinon.stub()
|
||||
|
||||
describe "with no ops", ->
|
||||
beforeEach ->
|
||||
@@ -66,7 +66,7 @@ describe "HistoryManager", ->
|
||||
@HistoryRedisManager.recordDocHasHistoryOps.called.should.equal false
|
||||
|
||||
it "should not flush doc changes", ->
|
||||
@HistoryManager._flushDocChangesAsync.called.should.equal false
|
||||
@HistoryManager.flushDocChangesAsync.called.should.equal false
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.called.should.equal true
|
||||
@@ -91,7 +91,7 @@ describe "HistoryManager", ->
|
||||
.calledWith(@project_id, @doc_id, @ops)
|
||||
|
||||
it "should not flush doc changes", ->
|
||||
@HistoryManager._flushDocChangesAsync.called.should.equal false
|
||||
@HistoryManager.flushDocChangesAsync.called.should.equal false
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.called.should.equal true
|
||||
@@ -114,7 +114,7 @@ describe "HistoryManager", ->
|
||||
.calledWith(@project_id, @doc_id, @ops)
|
||||
|
||||
it "should flush doc changes", ->
|
||||
@HistoryManager._flushDocChangesAsync
|
||||
@HistoryManager.flushDocChangesAsync
|
||||
.calledWith(@project_id, @doc_id)
|
||||
.should.equal true
|
||||
|
||||
@@ -132,7 +132,7 @@ describe "HistoryManager", ->
|
||||
)
|
||||
|
||||
it "should not flush doc changes", ->
|
||||
@HistoryManager._flushDocChangesAsync.called.should.equal false
|
||||
@HistoryManager.flushDocChangesAsync.called.should.equal false
|
||||
|
||||
it "should call the callback with the error", ->
|
||||
@callback.calledWith(@error).should.equal true
|
||||
|
||||
Reference in New Issue
Block a user