|
@@ -410,9 +410,9 @@ export default class Lobby {
|
410
|
410
|
|
411
|
411
|
/**
|
412
|
412
|
* Should be possible only for moderators.
|
413
|
|
- * @param id
|
|
413
|
+ * @param param or an array of ids.
|
414
|
414
|
*/
|
415
|
|
- approveAccess(id) {
|
|
415
|
+ approveAccess(param) {
|
416
|
416
|
if (!this.isSupported() || !this.mainRoom.isModerator()) {
|
417
|
417
|
return;
|
418
|
418
|
}
|
|
@@ -425,23 +425,38 @@ export default class Lobby {
|
425
|
425
|
mainRoomJid = this.mainRoom.getBreakoutRooms().getMainRoomJid();
|
426
|
426
|
}
|
427
|
427
|
|
428
|
|
- const memberRoomJid = Object.keys(this.lobbyRoom.members)
|
429
|
|
- .find(j => Strophe.getResourceFromJid(j) === id);
|
|
428
|
+ const membersToApprove = [];
|
|
429
|
+ let ids = param;
|
|
430
|
+
|
|
431
|
+ if (!Array.isArray(param)) {
|
|
432
|
+ ids = [ param ];
|
|
433
|
+ }
|
|
434
|
+
|
|
435
|
+ ids.forEach(id => {
|
|
436
|
+ const memberRoomJid = Object.keys(this.lobbyRoom.members)
|
|
437
|
+ .find(j => Strophe.getResourceFromJid(j) === id);
|
430
|
438
|
|
431
|
|
- if (memberRoomJid) {
|
432
|
|
- const jid = this.lobbyRoom.members[memberRoomJid].jid;
|
|
439
|
+ if (memberRoomJid) {
|
|
440
|
+ membersToApprove.push(this.lobbyRoom.members[memberRoomJid].jid);
|
|
441
|
+ } else {
|
|
442
|
+ logger.error(`Not found member for ${memberRoomJid} in lobby room.`);
|
|
443
|
+ }
|
|
444
|
+ });
|
|
445
|
+
|
|
446
|
+ if (membersToApprove.length > 0) {
|
433
|
447
|
const msgToSend
|
434
|
448
|
= $msg({ to: mainRoomJid })
|
435
|
|
- .c('x', { xmlns: 'http://jabber.org/protocol/muc#user' })
|
436
|
|
- .c('invite', { to: jid });
|
|
449
|
+ .c('x', { xmlns: 'http://jabber.org/protocol/muc#user' });
|
|
450
|
+
|
|
451
|
+ membersToApprove.forEach(jid => {
|
|
452
|
+ msgToSend.c('invite', { to: jid }).up();
|
|
453
|
+ });
|
437
|
454
|
|
438
|
455
|
this.xmpp.connection.sendIQ(msgToSend,
|
439
|
456
|
() => { }, // eslint-disable-line no-empty-function
|
440
|
457
|
e => {
|
441
|
|
- logger.error(`Error sending invite for ${jid}`, e);
|
|
458
|
+ logger.error(`Error sending invite for ${membersToApprove}`, e);
|
442
|
459
|
});
|
443
|
|
- } else {
|
444
|
|
- logger.error(`Not found member for ${memberRoomJid} in lobby room.`);
|
445
|
460
|
}
|
446
|
461
|
}
|
447
|
462
|
}
|