removed dupe code

v1.18.x
barisusakli 11 years ago
parent c1b61522f7
commit 79265b9e83

@ -31,9 +31,7 @@ var async = require('async'),
if (err || !topic) { if (err || !topic) {
return callback(err); return callback(err);
} }
topic.title = validator.escape(topic.title); modifyTopic(topic, callback);
topic.relativeTime = utils.toISOString(topic.timestamp);
callback(null, topic);
}); });
}; };
@ -48,18 +46,19 @@ var async = require('async'),
if (err) { if (err) {
return callback(err); return callback(err);
} }
async.map(topics, modifyTopic, callback);
});
};
for (var i=0; i<tids.length; ++i) { function modifyTopic(topic, callback) {
if(topics[i]) { if (!topic) {
topics[i].title = validator.escape(topics[i].title); return callback(null, topic);
topics[i].relativeTime = utils.toISOString(topics[i].timestamp);
} }
topic.title = validator.escape(topic.title);
topic.relativeTime = utils.toISOString(topic.timestamp);
callback(null, topic);
} }
callback(null, topics);
});
};
Topics.getPageCount = function(tid, uid, callback) { Topics.getPageCount = function(tid, uid, callback) {
Topics.getTopicField(tid, 'postcount', function(err, postCount) { Topics.getTopicField(tid, 'postcount', function(err, postCount) {
if (err) { if (err) {

Loading…
Cancel
Save