|
|
|
@ -18,7 +18,10 @@ marked.setOptions({
|
|
|
|
|
|
|
|
|
|
var post_data, user_data, thread_data, vote_data, viewer_data;
|
|
|
|
|
|
|
|
|
|
topics.markAsRead(tid, current_user);
|
|
|
|
|
getTopicPosts();
|
|
|
|
|
|
|
|
|
|
getUserReputation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//compile thread after all data is asynchronously called
|
|
|
|
|
function generateThread() {
|
|
|
|
@ -71,11 +74,18 @@ marked.setOptions({
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getTopicPosts() {
|
|
|
|
|
// get all data for thread in asynchronous fashion
|
|
|
|
|
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
|
|
|
|
|
RDB.handle(err);
|
|
|
|
|
|
|
|
|
|
if(pids.length === 0 ){
|
|
|
|
|
callback(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
topics.markAsRead(tid, current_user);
|
|
|
|
|
|
|
|
|
|
var content = [], uid = [], timestamp = [], pid = [], post_rep = [], editor = [], editTime = [], deleted = [];
|
|
|
|
|
|
|
|
|
|
for (var i=0, ii=pids.length; i<ii; i++) {
|
|
|
|
@ -142,7 +152,9 @@ marked.setOptions({
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getUserReputation() {
|
|
|
|
|
user.getUserField(current_user, 'reputation', function(reputation){
|
|
|
|
|
viewer_data = {
|
|
|
|
|
reputation: reputation
|
|
|
|
@ -150,6 +162,7 @@ marked.setOptions({
|
|
|
|
|
generateThread();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Posts.reply = function(socket, tid, uid, content) {
|
|
|
|
|