From ef60ce1660274b6f034191f28e515be71bea745d Mon Sep 17 00:00:00 2001 From: Josh Owens Date: Sat, 19 Jul 2014 00:16:28 -0400 Subject: [PATCH] Don't iterate all the users for finding who to send notifications to. --- server/notifications.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/notifications.js b/server/notifications.js index f4b1c0012..de52c75d0 100644 --- a/server/notifications.js +++ b/server/notifications.js @@ -53,7 +53,7 @@ Meteor.methods({ var currentUser = Meteor.users.findOne(this.userId); console.log('newPostNotify'); // send a notification to every user according to their notifications settings - Meteor.users.find().forEach(function(user) { + Meteor.users.find({'profile.notifications.posts': 1}).forEach(function(user) { // don't send users notifications for their own posts if(user._id !== currentUser._id && getUserSetting('notifications.posts', false, user)){ properties.userId = user._id; @@ -68,4 +68,4 @@ sendNotification = function (notification) { // console.log('send notification:') // console.log(notification) sendEmail(notification.to, notification.subject, notification.text, notification.html); -}; \ No newline at end of file +};