fix crashing issue
This commit is contained in:
parent
04d92b8781
commit
6c4f78446b
1 changed files with 17 additions and 16 deletions
33
update.js
33
update.js
|
@ -43,7 +43,6 @@ exports.padUpdate = function (hook_name, _pad) {
|
||||||
exports.notifyBegin = function(padId){
|
exports.notifyBegin = function(padId){
|
||||||
console.warn("Getting "+padId);
|
console.warn("Getting "+padId);
|
||||||
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
|
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
|
||||||
console.warn(recipients);
|
|
||||||
if(recipients){
|
if(recipients){
|
||||||
async.forEach(Object.keys(recipients), function(recipient, cb){
|
async.forEach(Object.keys(recipients), function(recipient, cb){
|
||||||
console.warn("Emailing "+recipient +" about a new begin update");
|
console.warn("Emailing "+recipient +" about a new begin update");
|
||||||
|
@ -69,21 +68,23 @@ exports.notifyEnd = function(padId){
|
||||||
var changesToPad = "Functionality does not exist";
|
var changesToPad = "Functionality does not exist";
|
||||||
|
|
||||||
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
|
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
|
||||||
async.forEach(Object.keys(recipients), function(recipient, cb){
|
if(recipients){
|
||||||
console.debug("Emailing "+recipient +" about a new begin update");
|
async.forEach(Object.keys(recipients), function(recipient, cb){
|
||||||
|
console.debug("Emailing "+recipient +" about a new begin update");
|
||||||
server.send({
|
|
||||||
text: "Your pad at "+urlToPads+padId +" has finished being edited, we're just emailing you let you know :) The changes look like this:" + changesToPad,
|
server.send({
|
||||||
from: fromName+ "<"+fromEmail+">",
|
text: "Your pad at "+urlToPads+padId +" has finished being edited, we're just emailing you let you know :) The changes look like this:" + changesToPad,
|
||||||
to: recipient,
|
from: fromName+ "<"+fromEmail+">",
|
||||||
subject: "Someone finished editing "+padId
|
to: recipient,
|
||||||
}, function(err, message) { console.log(err || message); });
|
subject: "Someone finished editing "+padId
|
||||||
|
}, function(err, message) { console.log(err || message); });
|
||||||
cb(); // finish each user
|
|
||||||
},
|
cb(); // finish each user
|
||||||
function(err){
|
},
|
||||||
|
function(err){
|
||||||
});
|
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue