closes #831, user profile changes

This commit is contained in:
Baris Soner Usakli
2014-02-04 17:31:05 -05:00
parent 3c63b135c7
commit 574e981de9
16 changed files with 288 additions and 123 deletions

View File

@@ -169,11 +169,30 @@ var db = require('./database'),
});
}, function(pids) {
if (!(pids && pids.length)) {
return callback(null, []);
return callback(null, { posts: [], nextStart: 0});
}
Posts.getPostSummaryByPids(pids, false, callback);
Posts.getPostSummaryByPids(pids, false, function(err, posts) {
if(err) {
return callback(err);
}
if(!posts || !posts.length) {
return callback(null, { posts: [], nextStart: 0});
}
db.sortedSetRevRank('uid:' + uid + ':posts', posts[posts.length - 1].pid, function(err, rank) {
if(err) {
return calllback(err);
}
var userPosts = {
posts: posts,
nextStart: parseInt(rank, 10) + 1
};
callback(null, userPosts);
});
});
});
});
}