mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #6768
This commit is contained in:
@@ -93,7 +93,7 @@
|
|||||||
"alerts.error-x": "<strong>Error</strong><p>%1</p>",
|
"alerts.error-x": "<strong>Error</strong><p>%1</p>",
|
||||||
"alerts.create-success": "User created!",
|
"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.email-sent-to": "An invitation email has been sent to %1",
|
||||||
"alerts.x-users-found": "%1 user(s) found! Search took %2 ms."
|
"alerts.x-users-found": "%1 user(s) found! Search took %2 ms."
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"filter-by": "Filter By",
|
"filter-by": "Filter By",
|
||||||
"online-only": "Online only",
|
"online-only": "Online only",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
|
"prompt-email": "Emails:",
|
||||||
"invitation-email-sent": "An invitation email has been sent to %1",
|
"invitation-email-sent": "An invitation email has been sent to %1",
|
||||||
"user_list": "User List",
|
"user_list": "User List",
|
||||||
"recent_topics": "Recent Topics",
|
"recent_topics": "Recent Topics",
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ define('forum/users', ['translator', 'benchpress'], function (translator, Benchp
|
|||||||
|
|
||||||
function handleInvite() {
|
function handleInvite() {
|
||||||
$('[component="user/invite"]').on('click', function () {
|
$('[component="user/invite"]').on('click', function () {
|
||||||
bootbox.prompt('Email: ', function (email) {
|
bootbox.prompt('[[users:prompt-email]]', function (email) {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,21 +289,19 @@ SocketUser.invite = function (socket, email, callback) {
|
|||||||
return next(new Error('[[error:no-privileges]]'));
|
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([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
user.getInvitesNumber(socket.uid, next);
|
user.getInvitesNumber(socket.uid, next);
|
||||||
},
|
},
|
||||||
function (invites, 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 + ']]'));
|
return next(new Error('[[error:invite-maximum-met, ' + invites + ', ' + max + ']]'));
|
||||||
}
|
}
|
||||||
|
email = email.split(',').map(email => email.trim()).filter(Boolean);
|
||||||
user.sendInvitationEmail(socket.uid, email, next);
|
async.eachSeries(email, function (email, next) {
|
||||||
|
user.sendInvitationEmail(socket.uid, email, next);
|
||||||
|
}, next);
|
||||||
},
|
},
|
||||||
], next);
|
], next);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user