mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-08 23:26:12 +02:00
fixed a crash if user profile is viewed when they have no posts, fixed the footer user link it uses the userslug now
This commit is contained in:
37
src/posts.js
37
src/posts.js
@@ -311,22 +311,27 @@ marked.setOptions({
|
||||
RDB.lrange('uid:' + uid + ':posts', 0, 10, function(err, pids) {
|
||||
if(err === null) {
|
||||
|
||||
Posts.getPostsByPids(pids, uid, function(posts) {
|
||||
var returnData = [];
|
||||
|
||||
var len = posts.postData.pid.length;
|
||||
|
||||
for (var i=0; i < len; ++i) {
|
||||
returnData.push({
|
||||
pid: posts.postData.pid[i],
|
||||
content: posts.postData.content[i],
|
||||
timestamp: utils.relativeTime(posts.postData.timestamp[i]),
|
||||
tid: posts.postData.tid[i]
|
||||
});
|
||||
};
|
||||
|
||||
callback(returnData);
|
||||
});
|
||||
if(pids && pids.length) {
|
||||
|
||||
Posts.getPostsByPids(pids, uid, function(posts) {
|
||||
var returnData = [];
|
||||
|
||||
var len = posts.postData.pid.length;
|
||||
|
||||
for (var i=0; i < len; ++i) {
|
||||
returnData.push({
|
||||
pid: posts.postData.pid[i],
|
||||
content: posts.postData.content[i],
|
||||
timestamp: utils.relativeTime(posts.postData.timestamp[i]),
|
||||
tid: posts.postData.tid[i]
|
||||
});
|
||||
};
|
||||
|
||||
callback(returnData);
|
||||
});
|
||||
}
|
||||
else
|
||||
callback([]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user