Node.js based forum software built for the modern web
prevent crash on getRecentReplies, and styled recent replies
psychobunny39b46eb12555
diff --git a/public/css/style.less b/public/css/style.lessindex ad98ce009b..2cafe50537 100644--- a/public/css/style.less+++ b/public/css/style.less@@ -303,28 +303,31 @@ footer.footer {line-height: 16px;margin-left: 1px;padding: 5px;-- img {- display: block;- float: left;- }- p {- display: block;- float: left;- width: 70%;- margin-left: 10px;- overflow: hidden;- height: 32px;- }- span {- display: block;- float: left;- width: 70%;- margin-left: 10px;- overflow: hidden;- height: 16px;- margin-top: -10px;- color: #666;++ li {+ line-height: 16px;+ img {+ display: block;+ float: left;+ }+ p {+ display: block;+ float: left;+ width: 70%;+ margin-left: 10px;+ overflow: hidden;+ height: 32px;+ }+ span {+ display: block;+ float: left;+ width: 70%;+ margin-left: 10px;+ overflow: hidden;+ height: 16px;+ margin-top: -10px;+ color: #666;+ }}}}diff --git a/public/templates/category.tpl b/public/templates/category.tplindex 846f1895b1..84195117e2 100644--- a/public/templates/category.tpl+++ b/public/templates/category.tpl@@ -133,6 +133,10 @@socket.emit('api:categories.getRecentReplies', cid);socket.on('api:categories.getRecentReplies', function(replies) {+ if (replies === false) {+ return;+ }+var users = replies.users,posts = replies.posts,recent_replies = document.getElementById('category_recent_replies');diff --git a/src/categories.js b/src/categories.jsindex 0e324dc250..4be12134cb 100644--- a/src/categories.js+++ b/src/categories.js@@ -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);});