Explorar el Código

Merge pull request #17 from sharelatex/ho-always-check-s3

Always get inS3 when getting doc
Henry Oswald hace 9 años
padre
commit
c2b96c7e1e

+ 3 - 1
services/docstore/app/coffee/DocManager.coffee

@@ -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)

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 0
services/docstore/test/acceptance/coffee/ArchiveDocsTests.coffee


+ 14 - 0
services/docstore/test/unit/coffee/DocManagerTests.coffee

@@ -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)

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio