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:
Baris Soner Usakli
2013-06-26 23:31:41 -04:00
parent 119708bc8a
commit caf81b7312
3 changed files with 31 additions and 20 deletions

View File

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