mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #22 from sharelatex/ja-pass-undo-flag
Pass undo flag to doc updater when restoring from history
This commit is contained in:
commit
b57f6b5162
4 changed files with 5 additions and 3 deletions
|
@ -30,6 +30,7 @@ module.exports = DocumentUpdaterManager =
|
|||
lines: content.split("\n")
|
||||
source: "restore"
|
||||
user_id: user_id
|
||||
undoing: true
|
||||
}, (error, res, body)->
|
||||
if error?
|
||||
return callback(error)
|
||||
|
|
|
@ -65,5 +65,5 @@ describe "Restoring a version", ->
|
|||
|
||||
it "should set the doc in the doc updater", ->
|
||||
MockDocUpdaterApi.setDoc
|
||||
.calledWith(@project_id, @doc_id, @restored_lines, @user_id)
|
||||
.calledWith(@project_id, @doc_id, @restored_lines, @user_id, true)
|
||||
.should.equal true
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = MockDocUpdaterApi =
|
|||
getDoc: (project_id, doc_id, callback = (error) ->) ->
|
||||
callback null, @docs[doc_id]
|
||||
|
||||
setDoc: (project_id, doc_id, lines, user_id, callback = (error) ->) ->
|
||||
setDoc: (project_id, doc_id, lines, user_id, undoing, callback = (error) ->) ->
|
||||
@docs[doc_id] ||= {}
|
||||
@docs[doc_id].lines = lines
|
||||
callback()
|
||||
|
@ -23,7 +23,7 @@ module.exports = MockDocUpdaterApi =
|
|||
res.send JSON.stringify doc
|
||||
|
||||
app.post "/project/:project_id/doc/:doc_id", express.bodyParser(), (req, res, next) =>
|
||||
@setDoc req.params.project_id, req.params.doc_id, req.body.lines, req.body.user_id, (errr, doc) ->
|
||||
@setDoc req.params.project_id, req.params.doc_id, req.body.lines, req.body.user_id, req.body.undoing, (errr, doc) ->
|
||||
if error?
|
||||
res.send 500
|
||||
else
|
||||
|
|
|
@ -70,6 +70,7 @@ describe "DocumentUpdaterManager", ->
|
|||
lines: @content.split("\n")
|
||||
source: "restore"
|
||||
user_id: @user_id
|
||||
undoing: true
|
||||
}).should.equal true
|
||||
|
||||
it "should call the callback", ->
|
||||
|
|
Loading…
Reference in a new issue