From 669a5135e164eb1feb64ee691c23a20f1a4a7ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 19 Sep 2018 14:38:07 -0400 Subject: [PATCH] closes #6768 --- public/language/en-GB/admin/manage/users.json | 2 +- public/language/en-GB/users.json | 1 + public/src/client/users.js | 2 +- src/socket.io/user.js | 14 ++++++-------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/public/language/en-GB/admin/manage/users.json b/public/language/en-GB/admin/manage/users.json index 2e4cfa2a5c..6a17cbf016 100644 --- a/public/language/en-GB/admin/manage/users.json +++ b/public/language/en-GB/admin/manage/users.json @@ -93,7 +93,7 @@ "alerts.error-x": "Error

%1

", "alerts.create-success": "User created!", - "alerts.prompt-email": "Email: ", + "alerts.prompt-email": "Emails: ", "alerts.email-sent-to": "An invitation email has been sent to %1", "alerts.x-users-found": "%1 user(s) found! Search took %2 ms." } \ No newline at end of file diff --git a/public/language/en-GB/users.json b/public/language/en-GB/users.json index 5c9d8b93a4..18cf03fde3 100644 --- a/public/language/en-GB/users.json +++ b/public/language/en-GB/users.json @@ -10,6 +10,7 @@ "filter-by": "Filter By", "online-only": "Online only", "invite": "Invite", + "prompt-email": "Emails:", "invitation-email-sent": "An invitation email has been sent to %1", "user_list": "User List", "recent_topics": "Recent Topics", diff --git a/public/src/client/users.js b/public/src/client/users.js index 3d541e0863..bf6873e693 100644 --- a/public/src/client/users.js +++ b/public/src/client/users.js @@ -130,7 +130,7 @@ define('forum/users', ['translator', 'benchpress'], function (translator, Benchp function handleInvite() { $('[component="user/invite"]').on('click', function () { - bootbox.prompt('Email: ', function (email) { + bootbox.prompt('[[users:prompt-email]]', function (email) { if (!email) { return; } diff --git a/src/socket.io/user.js b/src/socket.io/user.js index ece95c875e..582262b20d 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -289,21 +289,19 @@ SocketUser.invite = function (socket, email, callback) { return next(new Error('[[error:no-privileges]]')); } - var max = parseInt(meta.config.maximumInvites, 10); - if (!max) { - return user.sendInvitationEmail(socket.uid, email, callback); - } - async.waterfall([ function (next) { user.getInvitesNumber(socket.uid, next); }, function (invites, next) { - if (!isAdmin && invites >= max) { + var max = parseInt(meta.config.maximumInvites, 10); + if (!isAdmin && max && invites >= max) { return next(new Error('[[error:invite-maximum-met, ' + invites + ', ' + max + ']]')); } - - user.sendInvitationEmail(socket.uid, email, next); + email = email.split(',').map(email => email.trim()).filter(Boolean); + async.eachSeries(email, function (email, next) { + user.sendInvitationEmail(socket.uid, email, next); + }, next); }, ], next); },