mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #17 from sharelatex/ho-always-check-s3
Always get inS3 when getting doc
This commit is contained in:
commit
c2b96c7e1e
3 changed files with 31 additions and 3 deletions
|
@ -10,7 +10,9 @@ module.exports = DocManager =
|
||||||
# collection (which is all that this collection contains). In future, we should
|
# collection (which is all that this collection contains). In future, we should
|
||||||
# migrate this version property to be part of the docs collection, to guarantee
|
# migrate this version property to be part of the docs collection, to guarantee
|
||||||
# consitency between lines and version when writing/reading, and for a simpler schema.
|
# consitency between lines and version when writing/reading, and for a simpler schema.
|
||||||
getDoc: (project_id, doc_id, filter = { version: false }, callback = (error, doc) ->) ->
|
getDoc: (project_id, doc_id, filter = { version: false, inS3:true}, callback = (error, doc) ->) ->
|
||||||
|
if filter? and !filter.inS3?
|
||||||
|
filter.inS3 = true
|
||||||
MongoManager.findDoc project_id, doc_id, filter, (err, doc)->
|
MongoManager.findDoc project_id, doc_id, filter, (err, doc)->
|
||||||
if err?
|
if err?
|
||||||
return callback(err)
|
return callback(err)
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,6 +34,20 @@ describe "DocManager", ->
|
||||||
@MongoManager.findDoc = sinon.stub()
|
@MongoManager.findDoc = sinon.stub()
|
||||||
@MongoManager.getDocVersion = sinon.stub().yields(null, @version)
|
@MongoManager.getDocVersion = sinon.stub().yields(null, @version)
|
||||||
|
|
||||||
|
describe "when using a filter", ->
|
||||||
|
beforeEach ->
|
||||||
|
@MongoManager.findDoc.yields(null, @doc)
|
||||||
|
|
||||||
|
it "should always get inS3 even when filter is passed", (done)->
|
||||||
|
@DocManager.getDoc @project_id, @doc_id, {version: true}, =>
|
||||||
|
@MongoManager.findDoc.args[0][2].inS3.should.equal true
|
||||||
|
done()
|
||||||
|
|
||||||
|
it "should always get inS3 even when no filter is passed", (done)->
|
||||||
|
@DocManager.getDoc @project_id, @doc_id, undefined, =>
|
||||||
|
@MongoManager.findDoc.args[0][2].inS3.should.equal true
|
||||||
|
done()
|
||||||
|
|
||||||
describe "when the doc is in the doc collection", ->
|
describe "when the doc is in the doc collection", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@MongoManager.findDoc.yields(null, @doc)
|
@MongoManager.findDoc.yields(null, @doc)
|
||||||
|
|
Loading…
Reference in a new issue