From 43afe7ffab9fb6984aa90044a36ca99692b18798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 14 Oct 2020 23:38:16 -0400 Subject: [PATCH] refactor: async/await src/user/approval --- src/user/approval.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/user/approval.js b/src/user/approval.js index ba3ac2d07d..797ef9045f 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -1,6 +1,5 @@ 'use strict'; -const async = require('async'); const validator = require('validator'); const db = require('../database'); @@ -116,14 +115,12 @@ module.exports = function (User) { delete user.hashedPassword; return user; }); - - users = await async.map(users, async function (user) { + await Promise.all(users.map(async (user) => { // temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392 // need to keep this for getIPMatchedUsers user.ip = user.ip.replace('::ffff:', ''); await getIPMatchedUsers(user); user.customActions = [].concat(user.customActions); - return user; /* // then spam prevention plugins, using the "filter:user.getRegistrationQueue" hook can be like: user.customActions.push({ @@ -133,7 +130,8 @@ module.exports = function (User) { icon: 'fa-flag' }); */ - }); + })); + const results = await plugins.fireHook('filter:user.getRegistrationQueue', { users: users }); return results.users; };