Not take into account the 'pending' section when finding users to send a mail to

This commit is contained in:
quenenni 2013-04-03 00:41:11 +02:00
parent 787b9157be
commit a98c59fed5

View file

@ -43,6 +43,8 @@ exports.notifyBegin = function(padId){
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
if(recipients){
async.forEach(Object.keys(recipients), function(recipient, cb){
//avoid the 'pending' section
if (recipient != 'pending') {
// Is this recipient already on the pad?
exports.isUserEditingPad(padId, recipients[recipient].authorId, function(err,userIsOnPad){ // is the user already on the pad?
var onStart = typeof(recipients[recipient].onStart) == "undefined" || recipients[recipient].onStart?true:false; // In case onStart wasn't defined we set it to true
@ -59,6 +61,7 @@ exports.notifyBegin = function(padId){
console.debug("Didn't send an email because user is already on the pad");
}
});
}
cb(); // finish each user
},
function(err){
@ -75,6 +78,8 @@ exports.notifyEnd = function(padId){
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
if(recipients){
async.forEach(Object.keys(recipients), function(recipient, cb){
//avoid the 'pending' section
if (recipient != 'pending') {
// Is this recipient already on the pad?
exports.isUserEditingPad(padId, recipients[recipient].authorId, function(err,userIsOnPad){ // is the user already on the$
var onEnd = typeof(recipients[recipient].onEnd) == "undefined" || recipients[recipient].onEnd?true:false; // In case onEnd wasn't defined we set it to false
@ -92,6 +97,7 @@ exports.notifyEnd = function(padId){
console.debug("Didn't send an email because user is already on the pad");
}
});
}
cb(); // finish each user
},
function(err){