|
|
@ -84,6 +84,8 @@ marked.setOptions({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Topics.getTopicWithPosts = function(tid, current_user, callback) {
|
|
|
|
Topics.getTopicWithPosts = function(tid, current_user, callback) {
|
|
|
|
|
|
|
|
threadTools.exists(tid, function(exists) {
|
|
|
|
|
|
|
|
if (!exists) return callback(new Error('Topic tid \'' + tid + '\' not found'));
|
|
|
|
|
|
|
|
|
|
|
|
Topics.markAsRead(tid, current_user);
|
|
|
|
Topics.markAsRead(tid, current_user);
|
|
|
|
|
|
|
|
|
|
|
@ -107,13 +109,14 @@ marked.setOptions({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.parallel([getTopicData, getTopicPosts, getPrivileges], function(err, results) {
|
|
|
|
async.parallel([getTopicData, getTopicPosts, getPrivileges], function(err, results) {
|
|
|
|
|
|
|
|
if (err) console.log(err.message);
|
|
|
|
var topicData = results[0],
|
|
|
|
var topicData = results[0],
|
|
|
|
topicPosts = results[1],
|
|
|
|
topicPosts = results[1],
|
|
|
|
privileges = results[2];
|
|
|
|
privileges = results[2];
|
|
|
|
|
|
|
|
|
|
|
|
var main_posts = topicPosts.splice(0, 1);
|
|
|
|
var main_posts = topicPosts.splice(0, 1);
|
|
|
|
|
|
|
|
|
|
|
|
callback({
|
|
|
|
callback(null, {
|
|
|
|
'topic_name':topicData.title,
|
|
|
|
'topic_name':topicData.title,
|
|
|
|
'category_name':topicData.category_name,
|
|
|
|
'category_name':topicData.category_name,
|
|
|
|
'category_slug':topicData.category_slug,
|
|
|
|
'category_slug':topicData.category_slug,
|
|
|
@ -127,6 +130,7 @@ marked.setOptions({
|
|
|
|
'main_posts': main_posts
|
|
|
|
'main_posts': main_posts
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|