prevent crash on getRecentReplies, and styled recent replies

v1.18.x
psychobunny 12 years ago
parent 8c2b6cda69
commit 39b46eb125

@ -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;
}
}
}
}

@ -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');

@ -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);
});

Loading…
Cancel
Save