only return minimal info for pending and invited users

This commit is contained in:
Barış Soner Uşaklı
2017-09-15 17:07:43 -04:00
parent b840b96a4a
commit 4c0d430819
2 changed files with 12 additions and 4 deletions

View File

@@ -6,13 +6,21 @@ var db = require('../database');
var user = require('../user');
module.exports = function (Groups) {
Groups.getUsersFromSet = function (set, callback) {
Groups.getUsersFromSet = function (set, fields, callback) {
if (typeof fields === 'function') {
callback = fields;
fields = null;
}
async.waterfall([
function (next) {
db.getSetMembers(set, next);
},
function (uids, next) {
user.getUsersData(uids, next);
if (fields) {
user.getUsersFields(uids, fields, callback);
} else {
user.getUsersData(uids, next);
}
},
], callback);
};