From f20d27986b6165c0841b4954f6325fb6ade60413 Mon Sep 17 00:00:00 2001 From: hugh-obrien Date: Wed, 5 Sep 2018 10:20:41 +0100 Subject: [PATCH] create ip match notifications without forcing replacement --- .../Features/Notifications/NotificationsBuilder.coffee | 2 +- .../Features/Notifications/NotificationsHandler.coffee | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/Notifications/NotificationsBuilder.coffee b/services/web/app/coffee/Features/Notifications/NotificationsBuilder.coffee index 419a2a21f1..1b9eb56cf9 100644 --- a/services/web/app/coffee/Features/Notifications/NotificationsBuilder.coffee +++ b/services/web/app/coffee/Features/Notifications/NotificationsBuilder.coffee @@ -53,7 +53,7 @@ module.exports = university_name: body.name content: body.enrolment_ad_html logger.log user_id:userId, key:_key, "creating notification key for user" - NotificationsHandler.createNotification userId, _key, "notification_ip_matched_affiliation", messageOpts, null, callback + NotificationsHandler.createNotification userId, _key, "notification_ip_matched_affiliation", messageOpts, null, false, callback read: (callback = ->)-> NotificationsHandler.markAsReadWithKey userId, @key, callback diff --git a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee index 5a6ca47c2e..a0f6ae5c12 100644 --- a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee +++ b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee @@ -29,12 +29,15 @@ module.exports = unreadNotifications = [] callback(null, unreadNotifications) - createNotification: (user_id, key, templateKey, messageOpts, expiryDateTime, callback)-> + createNotification: (user_id, key, templateKey, messageOpts, expiryDateTime, forceCreate, callback)-> + if !callback + callback = forceCreate + forceCreate = true payload = { key:key messageOpts:messageOpts templateKey:templateKey - forceCreate: true + forceCreate:forceCreate } if expiryDateTime? payload.expires = expiryDateTime