Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(room-lock): hide dialog when conference fails
Lyubo Marinovb93bac5aa93a
diff --git a/react/features/room-lock/middleware.js b/react/features/room-lock/middleware.jsindex 23959f22c2..345c073b41 100644--- a/react/features/room-lock/middleware.js+++ b/react/features/room-lock/middleware.js@@ -21,31 +21,13 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);* Middleware that captures conference failed and checks for password required* error and requests a dialog for user to enter password.*- * @param {Store} store - Redux store.+ * @param {Store} store - The redux store.* @returns {Function}*/MiddlewareRegistry.register(store => next => action => {switch (action.type) {- case CONFERENCE_FAILED: {- const { conference, error } = action;-- if (conference- && error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {- // XXX The feature room-lock affords recovery after- // CONFERENCE_FAILED caused by- // JitsiConferenceErrors.PASSWORD_REQUIRED.- if (typeof error.recoverable === 'undefined') {- error.recoverable = true;- }- if (error.recoverable) {- store.dispatch(_openPasswordRequiredPrompt(conference));- }- } else {- store.dispatch(hideDialog(PasswordRequiredPrompt));- store.dispatch(hideDialog(RoomLockPrompt));- }- break;- }+ case CONFERENCE_FAILED:+ return _conferenceFailed(store, next, action);case LOCK_STATE_CHANGED:// TODO Remove this logic when all components interested in the lock@@ -62,18 +44,49 @@ MiddlewareRegistry.register(store => next => action => {return next(action);});+/**+ * Handles errors that occur when a conference fails.+ *+ * @param {Store} store - The redux store in which the specified action is being+ * dispatched.+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the+ * specified action to the specified store.+ * @param {Action} action - The redux action {@code CONFERENCE_FAILED} which+ * specifies the details associated with the error and the failed conference.+ * @private+ * @returns {*}+ */+function _conferenceFailed({ dispatch }, next, action) {+ const { conference, error } = action;++ if (conference && error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {+ // XXX The feature room-lock affords recovery after CONFERENCE_FAILED+ // caused by JitsiConferenceErrors.PASSWORD_REQUIRED.+ if (typeof error.recoverable === 'undefined') {+ error.recoverable = true;+ }+ if (error.recoverable) {+ dispatch(_openPasswordRequiredPrompt(conference));+ }+ } else {+ dispatch(hideDialog(PasswordRequiredPrompt));+ dispatch(hideDialog(RoomLockPrompt));+ }++ return next(action);+}+/*** Handles errors that occur when a password fails to be set.*- * @param {Store} store - The Redux store in which the specified action is being+ * @param {Store} store - The redux store in which the specified action is being* dispatched.- * @param {Dispatch} next - The Redux dispatch function to dispatch the+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the* specified action to the specified store.- * @param {Action} action - The Redux action SET_PASSWORD_ERROR which has the- * error type that should be handled.+ * @param {Action} action - The redux action {@code SET_PASSWORD_ERROR} which+ * has the error type that should be handled.* @private- * @returns {Object} The new state that is the result of the reduction of the- * specified action.+ * @returns {*}*/function _setPasswordFailed(store, next, action) {if (typeof APP !== 'undefined') {