mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
fixed home loading
This commit is contained in:
@@ -186,6 +186,11 @@ var RDB = require('./redis.js'),
|
|||||||
|
|
||||||
Categories.getRecentReplies = function(cid, count, callback) {
|
Categories.getRecentReplies = function(cid, count, callback) {
|
||||||
RDB.zrevrange('categories:recent_posts:cid:' + cid, 0, (count<10)?10:count, function(err, pids) {
|
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) {
|
if (pids.length == 0) {
|
||||||
callback([]);
|
callback([]);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ var RDB = require('./redis.js'),
|
|||||||
function getPostSummary(pid, callback) {
|
function getPostSummary(pid, callback) {
|
||||||
Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
|
Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
|
||||||
if(postData.deleted === '1') {
|
if(postData.deleted === '1') {
|
||||||
return;
|
return callback(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Posts.addUserInfoToPost(postData, function() {
|
Posts.addUserInfoToPost(postData, function() {
|
||||||
@@ -81,6 +81,8 @@ var RDB = require('./redis.js'),
|
|||||||
async.eachSeries(pids, getPostSummary, function(err) {
|
async.eachSeries(pids, getPostSummary, function(err) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
callback(returnData);
|
callback(returnData);
|
||||||
|
} else {
|
||||||
|
console.log(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ var user = require('./../user.js'),
|
|||||||
categories.getRecentReplies(category.cid, 2, function(posts) {
|
categories.getRecentReplies(category.cid, 2, function(posts) {
|
||||||
category["posts"] = posts;
|
category["posts"] = posts;
|
||||||
category["post_count"] = posts.length>2 ? 2 : posts.length;
|
category["post_count"] = posts.length>2 ? 2 : posts.length;
|
||||||
|
console.log(category.cid, 'worked');
|
||||||
callback(null);
|
callback(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user