made uid parameter optional in getPidIndex

This commit is contained in:
Julian Lam
2014-09-03 12:54:26 -04:00
parent 063d270f1a
commit baf72249b6

View File

@@ -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);