prevent crash on getRecentReplies, and styled recent replies

This commit is contained in:
psychobunny
2013-05-24 15:05:59 -04:00
parent 8c2b6cda69
commit 39b46eb125
3 changed files with 33 additions and 22 deletions

View File

@@ -262,6 +262,10 @@ var RDB = require('./redis.js'),
Categories.getRecentReplies = function(cid, callback) {
RDB.zrange('categories:recent_posts:cid:' + cid, 0, -1, function(err, pids) {
if (pids.length == 0) {
callback(false);
return;
}
posts.getPostSummaryByPids(pids, function(posts) {
callback(posts);
});