waterfall

v1.18.x
barisusakli 10 years ago
parent 414c2a8bd9
commit 83ad4ab042

@ -206,19 +206,17 @@ module.exports = function(Topics) {
Topics.updateTags = function(tid, tags, callback) {
callback = callback || function() {};
Topics.getTopicField(tid, 'timestamp', function(err, timestamp) {
if (err) {
return callback(err);
}
Topics.deleteTopicTags(tid, function(err) {
if (err) {
return callback(err);
async.waterfall([
function(next) {
Topics.deleteTopicTags(tid, next);
},
function(next) {
Topics.getTopicField(tid, 'timestamp', next);
},
function(timestamp, next) {
Topics.createTags(tags, tid, timestamp, next);
}
Topics.createTags(tags, tid, timestamp, callback);
});
});
], callback);
};
Topics.deleteTopicTags = function(tid, callback) {
@ -243,7 +241,9 @@ module.exports = function(Topics) {
updateTagCount(tag, next);
}, next);
}
], callback);
], function(err, results) {
callback(err);
});
});
};

Loading…
Cancel
Save