diff --git a/react/features/room-lock/actions.js b/react/features/room-lock/actions.js index 9b340398e..a331d5d23 100644 --- a/react/features/room-lock/actions.js +++ b/react/features/room-lock/actions.js @@ -1,6 +1,11 @@ // @flow -import { setPassword } from '../base/conference'; +import { appNavigate } from '../app'; +import { + conferenceLeft, + JITSI_CONFERENCE_URL_KEY, + setPassword +} from '../base/conference'; import { hideDialog, openDialog } from '../base/dialog'; import { PasswordRequiredPrompt, RoomLockPrompt } from './components'; @@ -23,6 +28,38 @@ export function beginRoomLockRequest(conference: ?Object) { }; } +/** + * Cancels a prompt for a password to join a specific conference/room. + * + * @param {JitsiConference} conference - The {@code JitsiConference} requesting + * the password to join. + * @protected + * @returns {Function} + */ +export function _cancelPasswordRequiredPrompt(conference: Object) { + return (dispatch: Dispatch<*>, getState: Function) => { + // Canceling PasswordRequiredPrompt is to navigate the app/user to + // WelcomePage. In other words, the canceling invalidates the + // locationURL. Make sure that the canceling indeed has the intent to + // invalidate the locationURL. + const state = getState(); + + if (conference === state['features/base/conference'].passwordRequired + && conference[JITSI_CONFERENCE_URL_KEY] + === state['features/base/connection'].locationURL) { + // XXX The error associated with CONFERENCE_FAILED was marked as + // recoverable by the feature room-lock and, consequently, + // recoverable-aware features such as mobile's external-api did not + // deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since + // the app/user is going to nativate to WelcomePage, the SDK + // clients/consumers need an event. + dispatch(conferenceLeft(conference)); + + dispatch(appNavigate(undefined)); + } + }; +} + /** * Ends a (user) request to lock a specific conference/room. * @@ -47,10 +84,10 @@ export function endRoomLockRequest( } /** - * Begins a request to enter password for a specific conference/room. + * Begins a prompt for a password to join a specific conference/room. * - * @param {JitsiConference} conference - The JitsiConference - * requesting password. + * @param {JitsiConference} conference - The {@code JitsiConference} + * requesting the password to join. * @protected * @returns {{ * type: OPEN_DIALOG, diff --git a/react/features/room-lock/components/PasswordRequiredPrompt.native.js b/react/features/room-lock/components/PasswordRequiredPrompt.native.js index 8abf022b8..5f5b51428 100644 --- a/react/features/room-lock/components/PasswordRequiredPrompt.native.js +++ b/react/features/room-lock/components/PasswordRequiredPrompt.native.js @@ -4,10 +4,11 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { appNavigate } from '../../app'; import { setPassword } from '../../base/conference'; import { Dialog } from '../../base/dialog'; +import { _cancelPasswordRequiredPrompt } from '../actions'; + /** * {@code PasswordRequiredPrompt}'s React {@code Component} prop types. */ @@ -87,7 +88,8 @@ class PasswordRequiredPrompt extends Component { * otherwise, {@code false}. */ _onCancel() { - this.props.dispatch(appNavigate(undefined)); + this.props.dispatch( + _cancelPasswordRequiredPrompt(this.props.conference)); return true; }