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

change override to forceCreate

Henry Oswald 10 лет назад
Родитель
Сommit
264ff806fc

+ 2 - 2
services/notifications/app/coffee/Notifications.coffee

@@ -20,10 +20,10 @@ module.exports =
 			user_id: ObjectId(user_id)
 			key: notification.key
 		db.notifications.count query, (err, number)->
-			if number > 0 and !notification.override
+			if number > 0 and !notification.forceCreate
 				logger.log number:number, user_id:user_id, key:notification.key, "alredy has notification key for user"
 				return callback(number)
-			else if number > 0 and notification.override
+			else if number > 0 and notification.forceCreate
 				self.removeNotificationKey user_id, notification.key, callback
 			else
 				callback()

+ 2 - 2
services/notifications/test/unit/coffee/NotificationsTests.coffee

@@ -77,12 +77,12 @@ describe 'Notifications Tests', ->
 				@insertStub.calledWith(@expectedDocument).should.equal false
 				done()
 
-		describe "when key already exists but override is passed", (done)->
+		describe "when key already exists but forceCreate is passed", (done)->
 
 			it "should delete the old key and insert the new one", ->
 				@insertStub.callsArgWith(1, null)
 				@countStub.callsArgWith(1, null, 1)
-				@stubbedNotification.override = true
+				@stubbedNotification.forceCreate = true
 				@notifications.addNotification user_id, @stubbedNotification, (err)=>
 					assert.deepEqual(@insertStub.lastCall.args[0], @expectedDocument)
 					@notifications.removeNotificationKey.calledWith(user_id, @stubbedNotification.key).should.equal true