mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
added error check to getTopicDataWithUser
This commit is contained in:
@@ -325,13 +325,13 @@ var async = require('async'),
|
||||
|
||||
Topics.getTopicDataWithUser = function(tid, callback) {
|
||||
Topics.getTopicData(tid, function(err, topic) {
|
||||
if(err) {
|
||||
return callback(err, null);
|
||||
if(err || !topic) {
|
||||
return callback(err || new Error('topic doesn\'t exist'));
|
||||
}
|
||||
|
||||
user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) {
|
||||
if(err) {
|
||||
return callback(err, null);
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
topic.username = userData.username;
|
||||
@@ -859,11 +859,7 @@ var async = require('async'),
|
||||
}
|
||||
|
||||
function getReadStatus(next) {
|
||||
if (uid && parseInt(uid, 10) > 0) {
|
||||
Topics.hasReadTopic(tid, uid, next);
|
||||
} else {
|
||||
next(null, null);
|
||||
}
|
||||
Topics.hasReadTopic(tid, uid, next);
|
||||
}
|
||||
|
||||
function getTeaser(next) {
|
||||
|
||||
Reference in New Issue
Block a user