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
Fix TypeError: Cannot read property 'isGuest' of undefined
Lyubo Marinov3c31a60b3277
diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.jsindex 15877b0ebc..5c1ad5b636 100644--- a/react/features/base/config/reducer.js+++ b/react/features/base/config/reducer.js@@ -58,6 +58,13 @@ function _setConfig(state, action) {// The config of INITIAL_STATE is meant to override the config// downloaded from the Jitsi Meet deployment because the former contains// values that are mandatory.+ //+ // FIXME At the time of this writing the hard-coded overriding values+ // are specific to mobile/React Native but the source code here is+ // executed on Web/React as well. The latter is not a practical problem+ // right now because the rest of the Web/React source code does not read+ // the overridden properties/values, it still relies on the global+ // variable config....INITIAL_STATE};}diff --git a/react/features/base/lib-jitsi-meet/actions.js b/react/features/base/lib-jitsi-meet/actions.jsindex e6d4eddc89..97bda7fb1b 100644--- a/react/features/base/lib-jitsi-meet/actions.js+++ b/react/features/base/lib-jitsi-meet/actions.js@@ -21,15 +21,9 @@ export function disposeLib() {return (dispatch: Dispatch<*>) => {dispatch({ type: LIB_WILL_DISPOSE });- // XXX We're wrapping it with Promise because:- // a) to be better aligned with initLib() method which is async;- // b) as currently there is no implementation for it in lib-jitsi-meet- // and there is a big chance it will be async.// TODO Currently, lib-jitsi-meet doesn't have the functionality to// dispose itself.- return (- Promise.resolve()- .then(() => dispatch({ type: LIB_DID_DISPOSE })));+ dispatch({ type: LIB_DID_DISPOSE });};}diff --git a/react/features/base/lib-jitsi-meet/middleware.js b/react/features/base/lib-jitsi-meet/middleware.jsindex deb6c9cd2c..f6f0b5b08f 100644--- a/react/features/base/lib-jitsi-meet/middleware.js+++ b/react/features/base/lib-jitsi-meet/middleware.js@@ -99,22 +99,23 @@ function _setConfig({ dispatch, getState }, next, action) {// disposed of first.// TODO Currently, disposeLib actually does not dispose of lib-jitsi-meet// because lib-jitsi-meet does not implement such functionality.- const disposeLibPromise- = initialized ? dispatch(disposeLib()) : Promise.resolve();-- disposeLibPromise.then(() => {- // Let the new config into the Redux store (because initLib will read it- // from there).- next(action);-- // FIXME Obviously, the following is bad design. However, I'm currently- // introducing the features base/config and base/logging and I'm trying- // to minimize the scope of the changes while I'm attempting to preserve- // compatibility with the existing partially React-ified Web source code- // and what was already executing on React Native. Additionally, I do- // not care to load logging_config.js on React Native.- dispatch(setLoggingConfig(window.loggingConfig));-- dispatch(initLib());- });+ if (initialized) {+ dispatch(disposeLib());+ }++ // Let the new config into the Redux store (because initLib will read it+ // from there).+ const result = next(action);++ // FIXME Obviously, the following is bad design. However, I'm currently+ // introducing the features base/config and base/logging and I'm trying to+ // minimize the scope of the changes while I'm attempting to preserve+ // compatibility with the existing partially React-ified Web source code and+ // what was already executing on React Native. Additionally, I do not care+ // to load logging_config.js on React Native.+ dispatch(setLoggingConfig(window.loggingConfig));++ dispatch(initLib());++ return result;}diff --git a/react/features/base/react/Platform.web.js b/react/features/base/react/Platform.web.jsindex 7066dfb018..b02cd17e20 100644--- a/react/features/base/react/Platform.web.js+++ b/react/features/base/react/Platform.web.js@@ -1,6 +1,6 @@/* @flow */-const userAgent = navigator.userAgent;+const { userAgent } = navigator;let OS;if (userAgent.match(/Android/i)) {diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.jsindex fbf7608a82..9396f19494 100644--- a/react/features/toolbox/actions.web.js+++ b/react/features/toolbox/actions.web.js@@ -172,9 +172,8 @@ export function showDesktopSharingButton(): Function {export function showDialPadButton(show: boolean): Function {return (dispatch: Dispatch<*>) => {const buttonName = 'dialpad';- const shouldShow = UIUtil.isButtonEnabled(buttonName) && show;- if (shouldShow) {+ if (show && UIUtil.isButtonEnabled(buttonName)) {dispatch(setToolbarButton(buttonName, {hidden: false}));@@ -205,11 +204,9 @@ export function showRecordingButton(): Function {export function showSharedVideoButton(): Function {return (dispatch: Dispatch<*>) => {const buttonName = 'sharedvideo';- const shouldShow- = UIUtil.isButtonEnabled(buttonName)- && !config.disableThirdPartyRequests;- if (shouldShow) {+ if (UIUtil.isButtonEnabled(buttonName)+ && !config.disableThirdPartyRequests) {dispatch(setToolbarButton(buttonName, {hidden: false}));@@ -218,28 +215,22 @@ export function showSharedVideoButton(): Function {}/**- * Shows SIP call button if it's required and appropriate- * flag is passed.+ * Shows SIP call button if it's required and appropriate flag is passed.** @param {boolean} show - Flag showing whether to show button or not.* @returns {Function}*/export function showSIPCallButton(show: boolean): Function {- return (dispatch: Dispatch<*>) => {+ return (dispatch: Dispatch<*>, getState: Function) => {const buttonName = 'sip';- // hide the button if there is a config to check for user roles,- // based on the token and the the user is guest- const shouldShow- = APP.conference.sipGatewayEnabled()+ if (show+ && APP.conference.sipGatewayEnabled()&& UIUtil.isButtonEnabled(buttonName)- && show&& (!config.enableUserRolesBasedOnToken- || !APP.tokenData.isGuest);-- if (shouldShow) {+ || !getState()['features/jwt'].isGuest)) {dispatch(setToolbarButton(buttonName, {- hidden: !shouldShow+ hidden: false}));}};