mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-06 23:00:08 +01:00
prevent crash on getRecentReplies, and styled recent replies
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user