Add changes

This commit is contained in:
Chi Vinh Le
2018-02-15 17:34:47 +01:00
parent a867b27f53
commit 214d9e5047
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ class Context {
this.log = parent.log || createLogger('context', this.id);
// Load the current logged in user to `user`, otherwise this will be null.
this.user = get(parent, 'user', null);
this.user = get(parent, 'user');
// Attach the connectors.
this.connectors = connectors;
+3 -7
View File
@@ -4,7 +4,6 @@ const util = require('./util');
const { SEARCH_OTHER_USERS } = require('../../perms/constants');
const UsersService = require('../../services/users');
const { escapeRegExp } = require('../../services/regex');
const UserModel = require('../../models/user');
@@ -56,12 +55,9 @@ const genUserByIDs = async (context, ids) => {
return [];
}
if (ids.length === 1) {
const user = await UsersService.findById(ids[0]);
return [user];
}
return UsersService.findByIdArray(ids).then(util.singleJoinBy(ids, 'id'));
return UserModel.find({ id: { $in: ids } }).then(
util.singleJoinBy(ids, 'id')
);
};
/**