Просмотр исходного кода

remove old rev, not needed any more

Henry Oswald 11 лет назад
Родитель
Сommit
32829f0e6e

+ 2 - 2
services/docstore/app/coffee/DocManager.coffee

@@ -41,7 +41,7 @@ module.exports = DocManager =
 					newDocLines: lines
 					newDocLines: lines
 					rev: oldRev
 					rev: oldRev
 				}, "updating doc lines"
 				}, "updating doc lines"
-				MongoManager.upsertIntoDocCollection project_id, doc_id, lines, oldRev, (error)->
+				MongoManager.upsertIntoDocCollection project_id, doc_id, lines, (error)->
 					return callback(callback) if error?
 					return callback(callback) if error?
 					callback null, true,  oldRev + 1 # rev will have been incremented in mongo by MongoManager.updateDoc
 					callback null, true,  oldRev + 1 # rev will have been incremented in mongo by MongoManager.updateDoc
 
 
@@ -49,7 +49,7 @@ module.exports = DocManager =
 		DocManager.getDoc project_id, doc_id, (error, doc) ->
 		DocManager.getDoc project_id, doc_id, (error, doc) ->
 			return callback(error) if error?
 			return callback(error) if error?
 			return callback new Errors.NotFoundError("No such project/doc to delete: #{project_id}/#{doc_id}") if !doc?
 			return callback new Errors.NotFoundError("No such project/doc to delete: #{project_id}/#{doc_id}") if !doc?
-			MongoManager.upsertIntoDocCollection project_id, doc_id, doc.lines, doc.rev, (error) ->
+			MongoManager.upsertIntoDocCollection project_id, doc_id, doc.lines, (error) ->
 				return callback(error) if error?
 				return callback(error) if error?
 				MongoManager.markDocAsDeleted doc_id, (error) ->
 				MongoManager.markDocAsDeleted doc_id, (error) ->
 					return callback(error) if error?
 					return callback(error) if error?

+ 1 - 1
services/docstore/app/coffee/MongoManager.coffee

@@ -9,7 +9,7 @@ module.exports = MongoManager =
 	getProjectsDocs: (project_id, callback)->
 	getProjectsDocs: (project_id, callback)->
 		db.docs.find project_id: ObjectId(project_id.toString()), {}, callback
 		db.docs.find project_id: ObjectId(project_id.toString()), {}, callback
 
 
-	upsertIntoDocCollection: (project_id, doc_id, lines, oldRev, callback)->
+	upsertIntoDocCollection: (project_id, doc_id, lines, callback)->
 		update =
 		update =
 			$set:{}
 			$set:{}
 			$inc:{}
 			$inc:{}

+ 4 - 4
services/docstore/test/unit/coffee/DocManagerTests.coffee

@@ -100,7 +100,7 @@ describe "DocManager", ->
 				@lines = ["mock", "doc", "lines"]
 				@lines = ["mock", "doc", "lines"]
 				@rev = 77
 				@rev = 77
 				@DocManager.getDoc = sinon.stub().callsArgWith(2, null, {lines: @lines, rev:@rev})
 				@DocManager.getDoc = sinon.stub().callsArgWith(2, null, {lines: @lines, rev:@rev})
-				@MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(4)
+				@MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(3)
 				@MongoManager.markDocAsDeleted = sinon.stub().callsArg(1)
 				@MongoManager.markDocAsDeleted = sinon.stub().callsArg(1)
 				@DocManager.deleteDoc @project_id, @doc_id, @callback
 				@DocManager.deleteDoc @project_id, @doc_id, @callback
 
 
@@ -111,7 +111,7 @@ describe "DocManager", ->
 
 
 			it "should update the doc lines", ->
 			it "should update the doc lines", ->
 				@MongoManager.upsertIntoDocCollection
 				@MongoManager.upsertIntoDocCollection
-					.calledWith(@project_id, @doc_id, @lines, @rev)
+					.calledWith(@project_id, @doc_id, @lines)
 					.should.equal true
 					.should.equal true
 
 
 			it "should mark doc as deleted", ->
 			it "should mark doc as deleted", ->
@@ -142,7 +142,7 @@ describe "DocManager", ->
 			@newDocLines = ["new", "doc", "lines"]
 			@newDocLines = ["new", "doc", "lines"]
 			@doc = { _id: @doc_id, lines: @oldDocLines, rev: @rev = 5 }
 			@doc = { _id: @doc_id, lines: @oldDocLines, rev: @rev = 5 }
 
 
-			@MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(4)
+			@MongoManager.upsertIntoDocCollection = sinon.stub().callsArg(3)
 			@MongoManager.findDoc = sinon.stub()
 			@MongoManager.findDoc = sinon.stub()
 
 
 		describe "when the doc lines have changed", ->
 		describe "when the doc lines have changed", ->
@@ -157,7 +157,7 @@ describe "DocManager", ->
 
 
 			it "should upsert the document to the doc collection", ->
 			it "should upsert the document to the doc collection", ->
 				@MongoManager.upsertIntoDocCollection
 				@MongoManager.upsertIntoDocCollection
-					.calledWith(@project_id, @doc_id, @newDocLines, @rev)
+					.calledWith(@project_id, @doc_id, @newDocLines)
 					.should.equal true				
 					.should.equal true				
 
 
 			it "should log out the old and new doc lines", ->
 			it "should log out the old and new doc lines", ->

+ 2 - 2
services/docstore/test/unit/coffee/MongoManagerTests.coffee

@@ -57,7 +57,7 @@ describe "MongoManager", ->
 			@oldRev = 77
 			@oldRev = 77
 
 
 		it "should upsert the document", (done)->	
 		it "should upsert the document", (done)->	
-			@MongoManager.upsertIntoDocCollection @project_id, @doc_id, @lines, @oldRev, (err)=>
+			@MongoManager.upsertIntoDocCollection @project_id, @doc_id, @lines, (err)=>
 				args = @db.docs.update.args[0]
 				args = @db.docs.update.args[0]
 				assert.deepEqual args[0], {_id: ObjectId(@doc_id)}
 				assert.deepEqual args[0], {_id: ObjectId(@doc_id)}
 				assert.equal args[1]["$set"]["lines"], @lines
 				assert.equal args[1]["$set"]["lines"], @lines
@@ -66,7 +66,7 @@ describe "MongoManager", ->
 				done()
 				done()
 
 
 		it "should return the error", (done)->
 		it "should return the error", (done)->
-			@MongoManager.upsertIntoDocCollection @project_id, @doc_id, @lines, @oldRev, (err)=>
+			@MongoManager.upsertIntoDocCollection @project_id, @doc_id, @lines, (err)=>
 				err.should.equal @stubbedErr
 				err.should.equal @stubbedErr
 				done()
 				done()