updating topics.getTeaser and get_last_undeleted_pid to return err first, and handled methods that called it

This commit is contained in:
Julian Lam
2013-07-15 15:03:42 -04:00
parent 5819b43595
commit 31f8be8a0a
3 changed files with 36 additions and 49 deletions

View File

@@ -243,10 +243,12 @@ var RDB = require('./redis.js'),
function(next) {
topics.getTopicField(tid, 'title', function(title) {
topics.getTeaser(tid, function(teaser) {
topics.getTeaser(tid, function(err, teaser) {
if (!err) {
notifications.create(teaser.username + ' has posted a reply to: "' + title + '"', null, '/topic/' + tid, 'topic:' + tid, function(nid) {
next(null, nid);
});
next(null, nid);
});
} else next(err);
});
});
@@ -259,9 +261,8 @@ var RDB = require('./redis.js'),
});
}
], function(err, results) {
if (!err) {
notifications.push(results[0], results[1]);
}
if (!err) notifications.push(results[0], results[1]);
// Otherwise, do nothing
});
}