|
|
@ -58,7 +58,7 @@ var async = require('async'),
|
|
|
|
Topics.getTopicDataWithUser = function(tid, callback) {
|
|
|
|
Topics.getTopicDataWithUser = function(tid, callback) {
|
|
|
|
Topics.getTopicData(tid, function(err, topic) {
|
|
|
|
Topics.getTopicData(tid, function(err, topic) {
|
|
|
|
if (err || !topic) {
|
|
|
|
if (err || !topic) {
|
|
|
|
return callback(err || new Error('topic doesn\'t exist'));
|
|
|
|
return callback(err || new Error('[[error:no-topic]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) {
|
|
|
|
user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) {
|
|
|
@ -101,7 +101,7 @@ var async = require('async'),
|
|
|
|
|
|
|
|
|
|
|
|
Topics.getTidPage = function(tid, uid, callback) {
|
|
|
|
Topics.getTidPage = function(tid, uid, callback) {
|
|
|
|
if(!tid) {
|
|
|
|
if(!tid) {
|
|
|
|
return callback(new Error('invalid-tid'));
|
|
|
|
return callback(new Error('[[error:invalid-tid]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
async.parallel({
|
|
|
@ -270,7 +270,7 @@ var async = require('async'),
|
|
|
|
Topics.getTopicWithPosts = function(tid, uid, start, end, callback) {
|
|
|
|
Topics.getTopicWithPosts = function(tid, uid, start, end, callback) {
|
|
|
|
Topics.getTopicData(tid, function(err, topicData) {
|
|
|
|
Topics.getTopicData(tid, function(err, topicData) {
|
|
|
|
if (err || !topicData) {
|
|
|
|
if (err || !topicData) {
|
|
|
|
return callback(err || new Error('Topic tid \'' + tid + '\' not found'));
|
|
|
|
return callback(err || new Error('[[error:no-topic]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
async.parallel({
|
|
|
@ -328,8 +328,8 @@ var async = require('async'),
|
|
|
|
posts.getPostFields(pid, ['pid', 'uid', 'timestamp'], function(err, postData) {
|
|
|
|
posts.getPostFields(pid, ['pid', 'uid', 'timestamp'], function(err, postData) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
return callback(err);
|
|
|
|
} else if(!postData) {
|
|
|
|
} else if(!postData || !postData.uid) {
|
|
|
|
return callback(new Error('no-teaser-found'));
|
|
|
|
return callback(new Error('[[error:no-teaser]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
user.getUserFields(postData.uid, ['username', 'userslug', 'picture'], function(err, userData) {
|
|
|
|
user.getUserFields(postData.uid, ['username', 'userslug', 'picture'], function(err, userData) {
|
|
|
|