fix(invite): IFrame api when invalid invitees are passed.

This commit is contained in:
hristoterezov 2018-08-03 12:06:06 -05:00 committed by Дамян Минков
parent fb75180632
commit bd8559fad6
2 changed files with 19 additions and 3 deletions

View File

@ -112,11 +112,21 @@ function initCommands() {
const { name } = request;
switch (name) {
case 'invite':
case 'invite': // eslint-disable-line no-case-declarations
const { invitees } = request;
if (!Array.isArray(invitees) || invitees.length === 0) {
callback({
error: new Error('Unexpected format of invitees')
});
break;
}
// The store should be already available because API.init is called
// on appWillMount action.
APP.store.dispatch(
invite(request.invitees, true))
invite(invitees, true))
.then(failedInvitees => {
let error;
let result;

View File

@ -238,7 +238,9 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
}
})
});
this.invite(invitees);
if (Array.isArray(invitees) && invitees.length > 0) {
this.invite(invitees);
}
this._isLargeVideoVisible = true;
this._numberOfParticipants = 0;
this._participants = {};
@ -597,6 +599,10 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
* @returns {Promise} - Resolves on success and rejects on failure.
*/
invite(invitees) {
if (!Array.isArray(invitees) || invitees.length === 0) {
return Promise.reject(new TypeError('Invalid Argument'));
}
return this._transport.sendRequest({
name: 'invite',
invitees