|
|
@ -21,11 +21,7 @@ module.exports = function (Posts) {
|
|
|
|
function (next) {
|
|
|
|
function (next) {
|
|
|
|
async.parallel({
|
|
|
|
async.parallel({
|
|
|
|
userData: function (next) {
|
|
|
|
userData: function (next) {
|
|
|
|
user.getUsersFields(uids, [
|
|
|
|
getUserData(uids, uid, next);
|
|
|
|
'uid', 'username', 'fullname', 'userslug',
|
|
|
|
|
|
|
|
'reputation', 'postcount', 'picture', 'signature',
|
|
|
|
|
|
|
|
'banned', 'banned:expire', 'status', 'lastonline', 'groupTitle',
|
|
|
|
|
|
|
|
], next);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
userSettings: function (next) {
|
|
|
|
userSettings: function (next) {
|
|
|
|
user.getMultipleUserSettings(uids, next);
|
|
|
|
user.getMultipleUserSettings(uids, next);
|
|
|
@ -119,6 +115,27 @@ module.exports = function (Posts) {
|
|
|
|
], callback);
|
|
|
|
], callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getUserData(uids, uid, callback) {
|
|
|
|
|
|
|
|
const fields = [
|
|
|
|
|
|
|
|
'uid', 'username', 'fullname', 'userslug',
|
|
|
|
|
|
|
|
'reputation', 'postcount', 'topiccount', 'picture',
|
|
|
|
|
|
|
|
'signature', 'banned', 'banned:expire', 'status',
|
|
|
|
|
|
|
|
'lastonline', 'groupTitle',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
|
|
|
|
function (next) {
|
|
|
|
|
|
|
|
plugins.fireHook('filter:posts.addUserFields', {
|
|
|
|
|
|
|
|
fields: fields,
|
|
|
|
|
|
|
|
uid: uid,
|
|
|
|
|
|
|
|
uids: uids,
|
|
|
|
|
|
|
|
}, next);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
function (result, next) {
|
|
|
|
|
|
|
|
user.getUsersFields(result.uids, _.uniq(result.fields), next);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
], callback);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Posts.isOwner = function (pid, uid, callback) {
|
|
|
|
Posts.isOwner = function (pid, uid, callback) {
|
|
|
|
uid = parseInt(uid, 10);
|
|
|
|
uid = parseInt(uid, 10);
|
|
|
|
if (Array.isArray(pid)) {
|
|
|
|
if (Array.isArray(pid)) {
|
|
|
|