unique recipient list

This commit is contained in:
Ivan Socolsky 2015-06-09 16:55:46 -03:00
parent 0f0d2183a1
commit 8151f68c3c
1 changed files with 4 additions and 1 deletions

View File

@ -124,8 +124,11 @@ EmailService.prototype._getRecipientsList = function(notification, emailType, cb
if (err) return cb(err);
if (_.isEmpty(preferences)) return cb(null, []);
var usedEmails = {};
var recipients = _.compact(_.map(preferences, function(p) {
if (!p.email) return;
if (!p.email || usedEmails[p.email]) return;
usedEmails[p.email] = true;
if (notification.creatorId == p.copayerId && !emailType.notifyDoer) return;
return {
copayerId: p.copayerId,