From 7678d83dd56f86ff150d5709983fc2d95fe88086 Mon Sep 17 00:00:00 2001 From: chptung Date: Fri, 7 Oct 2016 08:14:58 -0700 Subject: [PATCH] Update subscriberIdsToNotify to send unique emails Added .uniq() for subscribersIdsToNotify in the Categories section to prevent a user from receiving multiple emails if he/she is subscribed to multiple categories. --- packages/nova-subscribe/lib/callbacks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nova-subscribe/lib/callbacks.js b/packages/nova-subscribe/lib/callbacks.js index c56a0cb2e..c8403529b 100644 --- a/packages/nova-subscribe/lib/callbacks.js +++ b/packages/nova-subscribe/lib/callbacks.js @@ -90,7 +90,7 @@ if (typeof Package['nova:posts'] !== "undefined") { if (!!subscribers && !!subscribers.length) { // remove userIds of users that have already been notified and of post's author - let subscriberIdsToNotify = _.difference(subscribers, userIdsNotified, [post.userId]); + let subscriberIdsToNotify = _.uniq(_.difference(subscribers, userIdsNotified, [post.userId])); Telescope.notifications.create(subscriberIdsToNotify, 'newPost', notificationData);