diff --git a/services/notifications/app/coffee/Notifications.coffee b/services/notifications/app/coffee/Notifications.coffee index 1f0e1b8237..a9053734b9 100644 --- a/services/notifications/app/coffee/Notifications.coffee +++ b/services/notifications/app/coffee/Notifications.coffee @@ -27,11 +27,11 @@ module.exports = key: notification.key messageOpts: notification.messageOpts templateKey: notification.templateKey - expires: notification.expires || false # ttl index on `expiresFrom` field # in Mongo, TTL indexes only work on date fields, # and ignore the document when that field is missing - if doc.expires + if notification.expires? + doc.expires = notification.expires doc.expiresFrom = new Date() db.notifications.insert(doc, callback) diff --git a/services/notifications/test/unit/coffee/NotificationsTests.coffee b/services/notifications/test/unit/coffee/NotificationsTests.coffee index e329a9e34c..51215cb697 100644 --- a/services/notifications/test/unit/coffee/NotificationsTests.coffee +++ b/services/notifications/test/unit/coffee/NotificationsTests.coffee @@ -56,7 +56,6 @@ describe 'Notifications Tests', -> key:"notification-key", messageOpts:"some info", templateKey:"template-key", - expires: false } it 'should insert the notification into the collection', (done)->