Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(auth/external API): CONFERENCE_FAILED with login dialog

paweldomas36ecc99b5bb0
diff --git a/react/features/authentication/actions.js b/react/features/authentication/actions.js
index f58461f20e..0df6cace25 100644
--- a/react/features/authentication/actions.js
+++ b/react/features/authentication/actions.js
@@ -2,6 +2,7 @@
import { appNavigate } from '../app';
import { checkIfCanJoin, conferenceLeft } from '../base/conference';
+import { connectionFailed } from '../base/connection';
import { openDialog } from '../base/dialog';
import {
@@ -71,11 +72,28 @@ export function authenticateAndUpgradeRole(
* }}
*/
export function cancelLogin() {
- // FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify the
- // external-api.
+ return (dispatch: Dispatch<*>, getState: Function) => {
+ dispatch({ type: CANCEL_LOGIN });
- return {
- type: CANCEL_LOGIN
+ // XXX The error associated with CONNECTION_FAILED was marked as
+ // recoverable by the authentication feature and, consequently,
+ // recoverable-aware features such as mobile's external-api did not
+ // deliver the CONFERENCE_FAILED to the SDK clients/consumers (as
+ // a reaction to CONNECTION_FAILED). Since the
+ // app/user is going to navigate to WelcomePage, the SDK
+ // clients/consumers need an event.
+ const { error, passwordRequired }
+ = getState()['features/base/connection'];
+
+ passwordRequired
+ && dispatch(
+ connectionFailed(
+ passwordRequired,
+ error && error.name,
+ error && error.message,
+ error && error.credentials,
+ error && error.details,
+ /* recoverable */ false));
};
}
diff --git a/react/features/authentication/middleware.js b/react/features/authentication/middleware.js
index 12ea592c6c..9c3c49f250 100644
--- a/react/features/authentication/middleware.js
+++ b/react/features/authentication/middleware.js
@@ -108,9 +108,12 @@ MiddlewareRegistry.register(store => next => action => {
case CONNECTION_FAILED: {
const { error } = action;
- error
- && error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
- && store.dispatch(_openLoginDialog());
+ if (error
+ && error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
+ && typeof error.recoverable === 'undefined') {
+ error.recoverable = true;
+ store.dispatch(_openLoginDialog());
+ }
break;
}
diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js
index 82619bd7cb..88284b526a 100644
--- a/react/features/base/connection/actions.native.js
+++ b/react/features/base/connection/actions.native.js
@@ -178,6 +178,8 @@ export function connectionEstablished(connection: Object) {
* @param {Object} [credentials] - The invalid credentials that failed
* the authentication.
* @param {Object} [details] - The details about the connection failed event.
+ * @param {boolean} [recoverable] - Indicates whether this event is recoverable
+ * or not.
* @public
* @returns {{
* type: CONNECTION_FAILED,
@@ -190,7 +192,8 @@ export function connectionFailed(
error: string,
message: ?string,
credentials: ?Object,
- details: ?Object) {
+ details: ?Object,
+ recoverable: ?boolean) {
return {
type: CONNECTION_FAILED,
connection,
@@ -204,7 +207,8 @@ export function connectionFailed(
: undefined,
message,
name: error,
- details
+ details,
+ recoverable
}
};
}
diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.js
index 2d5785a65b..587eee458a 100644
--- a/react/features/base/connection/reducer.js
+++ b/react/features/base/connection/reducer.js
@@ -1,7 +1,8 @@
/* @flow */
import { SET_ROOM } from '../conference';
-import { assign, set, ReducerRegistry } from '../redux';
+import { JitsiConnectionErrors } from '../lib-jitsi-meet';
+import { assign, ReducerRegistry } from '../redux';
import { parseURIString } from '../util';
import {
@@ -80,7 +81,8 @@ function _connectionEstablished(
return assign(state, {
connecting: undefined,
connection,
- error: undefined
+ error: undefined,
+ passwordRequired: undefined
});
}
@@ -113,7 +115,10 @@ function _connectionFailed(
return assign(state, {
connecting: undefined,
connection: undefined,
- error
+ error,
+ passwordRequired:
+ error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
+ ? connection : undefined
});
}
@@ -132,7 +137,8 @@ function _connectionWillConnect(
{ connection }: { connection: Object }) {
return assign(state, {
connecting: connection,
- error: undefined
+ error: undefined,
+ passwordRequired: undefined
});
}
@@ -209,5 +215,8 @@ function _setLocationURL(
* reduction of the specified action.
*/
function _setRoom(state: Object) {
- return set(state, 'error', undefined);
+ return assign(state, {
+ error: undefined,
+ passwordRequired: undefined
+ });
}
diff --git a/react/features/mobile/external-api/middleware.js b/react/features/mobile/external-api/middleware.js
index b7ef489a11..29f5003f88 100644
--- a/react/features/mobile/external-api/middleware.js
+++ b/react/features/mobile/external-api/middleware.js
@@ -58,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
break;
case CONNECTION_FAILED:
- _sendConferenceFailedOnConnectionError(store, action);
+ !action.error.recoverable
+ && _sendConferenceFailedOnConnectionError(store, action);
break;
case ENTER_PICTURE_IN_PICTURE: