fixed home loading

v1.18.x
Baris Usakli 12 years ago
parent e69928d624
commit e979d1bf0d

@ -186,6 +186,11 @@ var RDB = require('./redis.js'),
Categories.getRecentReplies = function(cid, count, callback) {
RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, (count<10)?10:count, function(err, pids) {
if(err) {
console.log(err);
callback([]);
return;
}
if (pids.length == 0) {
callback([]);

@ -60,7 +60,7 @@ var RDB = require('./redis.js'),
function getPostSummary(pid, callback) {
Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
if(postData.deleted === '1') {
return;
return callback(null);
}
Posts.addUserInfoToPost(postData, function() {
@ -81,6 +81,8 @@ var RDB = require('./redis.js'),
async.eachSeries(pids, getPostSummary, function(err) {
if(!err) {
callback(returnData);
} else {
console.log(err);
}
});
};

@ -26,6 +26,7 @@ var user = require('./../user.js'),
categories.getRecentReplies(category.cid, 2, function(posts) {
category["posts"] = posts;
category["post_count"] = posts.length>2 ? 2 : posts.length;
console.log(category.cid, 'worked');
callback(null);
});
}

Loading…
Cancel
Save