From 04232986abdf56a5f8b3d78c59569297877b143c Mon Sep 17 00:00:00 2001 From: Aziz Khoury Date: Tue, 15 Jan 2019 21:37:30 +0200 Subject: [PATCH] related to https://github.com/NodeBB/NodeBB/issues/7212 --- src/user/approval.js | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/src/user/approval.js b/src/user/approval.js index f3a9712aa3..9429fef270 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -1,8 +1,6 @@ 'use strict'; var async = require('async'); -var request = require('request'); -var winston = require('winston'); var validator = require('validator'); var db = require('../database'); @@ -197,16 +195,9 @@ module.exports = function (User) { async.map(users, function (user, next) { // temporary: see http://www.stopforumspam.com/forum/viewtopic.php?id=6392 + // need to keep this for getIPMatchedUsers user.ip = user.ip.replace('::ffff:', ''); - - async.parallel([ - function (next) { - getIPMatchedUsers(user, next); - }, - function (next) { - getSpamData(user, next); - }, - ], function (err) { + getIPMatchedUsers(user, function (err) { next(err, user); }); }, next); @@ -234,34 +225,4 @@ module.exports = function (User) { }, ], callback); } - - function getSpamData(user, callback) { - async.waterfall([ - function (next) { - request({ - method: 'get', - url: 'http://api.stopforumspam.org/api' + - '?ip=' + encodeURIComponent(user.ip) + - '&email=' + encodeURIComponent(user.email) + - '&username=' + encodeURIComponent(user.username) + - '&f=json', - json: true, - }, next); - }, - function (response, body, next) { - if (response.statusCode === 200 && body) { - user.spamData = body; - user.usernameSpam = body.username ? (body.username.frequency > 0 || body.username.appears > 0) : true; - user.emailSpam = body.email ? (body.email.frequency > 0 || body.email.appears > 0) : true; - user.ipSpam = body.ip ? (body.ip.frequency > 0 || body.ip.appears > 0) : true; - } - next(); - }, - ], function (err) { - if (err) { - winston.error(err); - } - callback(); - }); - } };