mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
change override to forceCreate
This commit is contained in:
parent
7280262f92
commit
264ff806fc
2 changed files with 4 additions and 4 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue