mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #5043
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
"nodebb-plugin-spam-be-gone": "0.4.10",
|
||||
"nodebb-rewards-essentials": "0.0.9",
|
||||
"nodebb-theme-lavender": "3.0.14",
|
||||
"nodebb-theme-persona": "4.1.49",
|
||||
"nodebb-theme-persona": "4.1.50",
|
||||
"nodebb-theme-vanilla": "5.1.33",
|
||||
"nodebb-widget-essentials": "2.0.11",
|
||||
"nodemailer": "2.0.0",
|
||||
|
||||
@@ -59,5 +59,7 @@
|
||||
"membership.reject": "Reject",
|
||||
|
||||
"new-group.group_name": "Group Name:",
|
||||
"upload-group-cover": "Upload group cover"
|
||||
"upload-group-cover": "Upload group cover",
|
||||
"bulk-invite-instructions": "Enter a list of comma separated usernames to invite to this group",
|
||||
"bulk-invite": "Bulk Invite"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/* globals define, socket, ajaxify, app, bootbox, utils, RELATIVE_PATH */
|
||||
/* globals define, socket, ajaxify, app, bootbox, utils, config */
|
||||
|
||||
define('forum/groups/details', [
|
||||
'forum/groups/memberlist',
|
||||
@@ -227,7 +227,10 @@ define('forum/groups/details', [
|
||||
};
|
||||
|
||||
function handleMemberInvitations() {
|
||||
if (ajaxify.data.group.isOwner) {
|
||||
if (!ajaxify.data.group.isOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
var searchInput = $('[component="groups/members/invite"]');
|
||||
require(['autocomplete'], function(autocomplete) {
|
||||
autocomplete.user(searchInput, function(event, selected) {
|
||||
@@ -235,15 +238,30 @@ define('forum/groups/details', [
|
||||
toUid: selected.item.user.uid,
|
||||
groupName: ajaxify.data.group.name
|
||||
}, function(err) {
|
||||
if (!err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
ajaxify.refresh();
|
||||
} else {
|
||||
app.alertError(err.message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('[component="groups/members/bulk-invite-button"]').on('click', function() {
|
||||
var usernames = $('[component="groups/members/bulk-invite"]').val();
|
||||
if (!usernames) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
socket.emit('groups.issueMassInvite', {
|
||||
usernames: usernames,
|
||||
groupName: ajaxify.data.group.name
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
ajaxify.refresh();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function removeCover() {
|
||||
|
||||
@@ -135,6 +135,28 @@ SocketGroups.issueInvite = isOwner(function(socket, data, callback) {
|
||||
groups.invite(data.groupName, data.toUid, callback);
|
||||
});
|
||||
|
||||
SocketGroups.issueMassInvite = isOwner(function(socket, data, callback) {
|
||||
if (!data || !data.usernames || !data.groupName) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
var usernames = data.usernames.split(',');
|
||||
usernames = usernames.map(function(username) {
|
||||
return username && username.trim();
|
||||
});
|
||||
user.getUidsByUsernames(usernames, function(err, uids) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
uids = uids.filter(function(uid) {
|
||||
return !!uid && parseInt(uid, 10);
|
||||
});
|
||||
|
||||
async.eachSeries(uids, function(uid, next) {
|
||||
groups.invite(data.groupName, uid, callback);
|
||||
}, callback);
|
||||
});
|
||||
});
|
||||
|
||||
SocketGroups.rescindInvite = isOwner(function(socket, data, callback) {
|
||||
groups.rejectMembership(data.groupName, data.toUid, callback);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user