mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: async/await src/user/approval
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const async = require('async');
|
|
||||||
const validator = require('validator');
|
const validator = require('validator');
|
||||||
|
|
||||||
const db = require('../database');
|
const db = require('../database');
|
||||||
@@ -116,14 +115,12 @@ module.exports = function (User) {
|
|||||||
delete user.hashedPassword;
|
delete user.hashedPassword;
|
||||||
return user;
|
return user;
|
||||||
});
|
});
|
||||||
|
await Promise.all(users.map(async (user) => {
|
||||||
users = await async.map(users, async function (user) {
|
|
||||||
// temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392
|
// temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392
|
||||||
// need to keep this for getIPMatchedUsers
|
// need to keep this for getIPMatchedUsers
|
||||||
user.ip = user.ip.replace('::ffff:', '');
|
user.ip = user.ip.replace('::ffff:', '');
|
||||||
await getIPMatchedUsers(user);
|
await getIPMatchedUsers(user);
|
||||||
user.customActions = [].concat(user.customActions);
|
user.customActions = [].concat(user.customActions);
|
||||||
return user;
|
|
||||||
/*
|
/*
|
||||||
// then spam prevention plugins, using the "filter:user.getRegistrationQueue" hook can be like:
|
// then spam prevention plugins, using the "filter:user.getRegistrationQueue" hook can be like:
|
||||||
user.customActions.push({
|
user.customActions.push({
|
||||||
@@ -133,7 +130,8 @@ module.exports = function (User) {
|
|||||||
icon: 'fa-flag'
|
icon: 'fa-flag'
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
});
|
}));
|
||||||
|
|
||||||
const results = await plugins.fireHook('filter:user.getRegistrationQueue', { users: users });
|
const results = await plugins.fireHook('filter:user.getRegistrationQueue', { users: users });
|
||||||
return results.users;
|
return results.users;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user