From 43ab8e3ca8e6d73d6e889421d6e208a4b091e500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 28 Jan 2022 08:14:54 -0600 Subject: [PATCH] fix: Fixes #10796 authentication in conference. (#10848) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Fixes #10796 authentication in conference. * fixup! * fixup2! Co-authored-by: Saúl Ibarra Corretgé --- .../components/native/LoginDialog.js | 4 ++-- .../components/web/LoginDialog.js | 4 ++-- .../authentication/middleware.native.js | 21 ++++++++++++++--- .../features/authentication/middleware.web.js | 23 ++++++++++++++++--- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/react/features/authentication/components/native/LoginDialog.js b/react/features/authentication/components/native/LoginDialog.js index 105982f3be..4ab7612aad 100644 --- a/react/features/authentication/components/native/LoginDialog.js +++ b/react/features/authentication/components/native/LoginDialog.js @@ -337,7 +337,7 @@ function _mapStateToProps(state) { progress, thenableWithCancel } = state['features/authentication']; - const { authRequired } = state['features/base/conference']; + const { authRequired, conference } = state['features/base/conference']; const { hosts: configHosts } = state['features/base/config']; const { connecting, @@ -346,7 +346,7 @@ function _mapStateToProps(state) { return { ..._abstractMapStateToProps(state), - _conference: authRequired, + _conference: authRequired || conference, _configHosts: configHosts, _connecting: Boolean(connecting) || Boolean(thenableWithCancel), _error: connectionError || authenticateAndUpgradeRoleError, diff --git a/react/features/authentication/components/web/LoginDialog.js b/react/features/authentication/components/web/LoginDialog.js index 775da1a370..d5bd2eddbd 100644 --- a/react/features/authentication/components/web/LoginDialog.js +++ b/react/features/authentication/components/web/LoginDialog.js @@ -299,7 +299,7 @@ function mapStateToProps(state) { progress, thenableWithCancel } = state['features/authentication']; - const { authRequired } = state['features/base/conference']; + const { authRequired, conference } = state['features/base/conference']; const { hosts: configHosts } = state['features/base/config']; const { connecting, @@ -307,7 +307,7 @@ function mapStateToProps(state) { } = state['features/base/connection']; return { - _conference: authRequired, + _conference: authRequired || conference, _configHosts: configHosts, _connecting: connecting || thenableWithCancel, _error: connectionError || authenticateAndUpgradeRoleError, diff --git a/react/features/authentication/middleware.native.js b/react/features/authentication/middleware.native.js index c67be2889d..3f0a8a5c6a 100644 --- a/react/features/authentication/middleware.native.js +++ b/react/features/authentication/middleware.native.js @@ -19,6 +19,7 @@ import { MiddlewareRegistry } from '../base/redux'; import { CANCEL_LOGIN, STOP_WAIT_FOR_OWNER, + UPGRADE_ROLE_FINISHED, WAIT_FOR_OWNER } from './actionTypes'; import { @@ -61,10 +62,15 @@ MiddlewareRegistry.register(store => next => action => { // Go back to the app's entry point. _hideLoginDialog(store); - // FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify - // the external-api. + const { authRequired, conference } = getState()['features/base/conference']; - dispatch(appNavigate(undefined)); + // Only end the meeting if we are not already inside and trying to upgrade. + if (authRequired && !conference) { + // FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify + // the external-api. + + dispatch(appNavigate(undefined)); + } } break; } @@ -123,6 +129,15 @@ MiddlewareRegistry.register(store => next => action => { store.dispatch(hideDialog(WaitForOwnerDialog)); break; + case UPGRADE_ROLE_FINISHED: { + const { error, progress } = action; + + if (!error && progress === 1) { + _hideLoginDialog(store); + } + break; + } + case WAIT_FOR_OWNER: { _clearExistingWaitForOwnerTimeout(store); diff --git a/react/features/authentication/middleware.web.js b/react/features/authentication/middleware.web.js index c43738fcb1..184317592b 100644 --- a/react/features/authentication/middleware.web.js +++ b/react/features/authentication/middleware.web.js @@ -16,6 +16,7 @@ import { MiddlewareRegistry } from '../base/redux'; import { CANCEL_LOGIN, STOP_WAIT_FOR_OWNER, + UPGRADE_ROLE_FINISHED, WAIT_FOR_OWNER } from './actionTypes'; import { @@ -39,16 +40,23 @@ MiddlewareRegistry.register(store => next => action => { switch (action.type) { case CANCEL_LOGIN: { + const { dispatch, getState } = store; + if (!isDialogOpen(store, WaitForOwnerDialog)) { if (_isWaitingForOwner(store)) { - store.dispatch(openWaitForOwnerDialog()); + dispatch(openWaitForOwnerDialog()); return next(action); } - store.dispatch(hideLoginDialog()); + dispatch(hideLoginDialog()); + + const { authRequired, conference } = getState()['features/base/conference']; - store.dispatch(maybeRedirectToWelcomePage()); + // Only end the meeting if we are not already inside and trying to upgrade. + if (authRequired && !conference) { + dispatch(maybeRedirectToWelcomePage()); + } } break; } @@ -91,6 +99,15 @@ MiddlewareRegistry.register(store => next => action => { store.dispatch(hideDialog(WaitForOwnerDialog)); break; + case UPGRADE_ROLE_FINISHED: { + const { error, progress } = action; + + if (!error && progress === 1) { + store.dispatch(hideLoginDialog()); + } + break; + } + case WAIT_FOR_OWNER: { _clearExistingWaitForOwnerTimeout(store);