made uid parameter optional in getPidIndex

v1.18.x
Julian Lam 11 years ago
parent 063d270f1a
commit baf72249b6

@ -532,10 +532,20 @@ var async = require('async'),
}
Posts.getPidIndex = function(pid, uid, callback) {
callback = callback || function() {};
// Making uid optional
if ((!uid && !callback) || typeof uid === 'function') {
callback = uid;
uid = undefined;
}
async.parallel({
settings: function(next) {
user.getSettings(uid, next);
if (uid) {
user.getSettings(uid, next);
} else {
// No uid specified, so return empty object so that the check below will assume regular topic post sorting
next(null, {});
}
},
tid: function(next) {
Posts.getPostField(pid, 'tid', next);

Loading…
Cancel
Save