Merge pull request #1580 from jitsi/fix-isguest-typeerror

Fix TypeError: Cannot read property 'isGuest' of undefined
This commit is contained in:
Дамян Минков 2017-05-18 13:10:28 -05:00 committed by GitHub
commit ec881e0fd0
6 changed files with 44 additions and 51 deletions

View File

@ -29,12 +29,12 @@
"bootstrap": "3.1.1", "bootstrap": "3.1.1",
"es6-iterator": "2.0.1", "es6-iterator": "2.0.1",
"es6-symbol": "3.1.1", "es6-symbol": "3.1.1",
"i18next": "8.0.0", "i18next": "8.2.1",
"i18next-browser-languagedetector": "1.0.1", "i18next-browser-languagedetector": "1.0.1",
"i18next-xhr-backend": "1.4.1", "i18next-xhr-backend": "1.4.1",
"jitsi-meet-logger": "jitsi/jitsi-meet-logger", "jitsi-meet-logger": "jitsi/jitsi-meet-logger",
"jquery": "2.1.4", "jquery": "2.1.4",
"jquery-contextmenu": "2.4.3", "jquery-contextmenu": "2.4.5",
"jquery-i18next": "1.2.0", "jquery-i18next": "1.2.0",
"jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0", "jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
"jquery-ui": "1.10.5", "jquery-ui": "1.10.5",
@ -45,14 +45,14 @@
"postis": "2.2.0", "postis": "2.2.0",
"react": "15.4.2", "react": "15.4.2",
"react-dom": "15.4.2", "react-dom": "15.4.2",
"react-i18next": "3.1.0", "react-i18next": "4.1.0",
"react-native": "0.42.3", "react-native": "0.42.3",
"react-native-background-timer": "1.0.0", "react-native-background-timer": "1.0.1",
"react-native-immersive": "0.0.4", "react-native-immersive": "0.0.5",
"react-native-keep-awake": "2.0.3", "react-native-keep-awake": "2.0.4",
"react-native-locale-detector": "1.0.1", "react-native-locale-detector": "1.0.1",
"react-native-prompt": "1.0.0", "react-native-prompt": "1.0.0",
"react-native-vector-icons": "4.0.1", "react-native-vector-icons": "4.1.1",
"react-native-webrtc": "jitsi/react-native-webrtc", "react-native-webrtc": "jitsi/react-native-webrtc",
"react-redux": "5.0.4", "react-redux": "5.0.4",
"redux": "3.6.0", "redux": "3.6.0",
@ -74,11 +74,11 @@
"babel-preset-react": "6.24.1", "babel-preset-react": "6.24.1",
"babel-preset-stage-1": "6.24.1", "babel-preset-stage-1": "6.24.1",
"clean-css": "3.4.25", "clean-css": "3.4.25",
"css-loader": "0.28.0", "css-loader": "0.28.1",
"eslint": "3.19.0", "eslint": "3.19.0",
"eslint-plugin-flowtype": "2.30.4", "eslint-plugin-flowtype": "2.30.4",
"eslint-plugin-import": "2.2.0", "eslint-plugin-import": "2.2.0",
"eslint-plugin-jsdoc": "3.0.2", "eslint-plugin-jsdoc": "3.1.0",
"eslint-plugin-react": "6.10.3", "eslint-plugin-react": "6.10.3",
"eslint-plugin-react-native": "2.3.2", "eslint-plugin-react-native": "2.3.2",
"expose-loader": "0.7.3", "expose-loader": "0.7.3",
@ -91,7 +91,7 @@
"node-sass": "3.13.1", "node-sass": "3.13.1",
"precommit-hook": "3.0.0", "precommit-hook": "3.0.0",
"string-replace-loader": "1.2.0", "string-replace-loader": "1.2.0",
"style-loader": "0.16.1", "style-loader": "0.17.0",
"webpack": "1.14.0", "webpack": "1.14.0",
"webpack-dev-server": "1.16.3" "webpack-dev-server": "1.16.3"
}, },

View File

@ -58,6 +58,13 @@ function _setConfig(state, action) {
// The config of INITIAL_STATE is meant to override the config // The config of INITIAL_STATE is meant to override the config
// downloaded from the Jitsi Meet deployment because the former contains // downloaded from the Jitsi Meet deployment because the former contains
// values that are mandatory. // 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 ...INITIAL_STATE
}; };
} }

View File

@ -21,15 +21,9 @@ export function disposeLib() {
return (dispatch: Dispatch<*>) => { return (dispatch: Dispatch<*>) => {
dispatch({ type: LIB_WILL_DISPOSE }); 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 // TODO Currently, lib-jitsi-meet doesn't have the functionality to
// dispose itself. // dispose itself.
return ( dispatch({ type: LIB_DID_DISPOSE });
Promise.resolve()
.then(() => dispatch({ type: LIB_DID_DISPOSE })));
}; };
} }

View File

@ -99,22 +99,23 @@ function _setConfig({ dispatch, getState }, next, action) {
// disposed of first. // disposed of first.
// TODO Currently, disposeLib actually does not dispose of lib-jitsi-meet // TODO Currently, disposeLib actually does not dispose of lib-jitsi-meet
// because lib-jitsi-meet does not implement such functionality. // because lib-jitsi-meet does not implement such functionality.
const disposeLibPromise if (initialized) {
= initialized ? dispatch(disposeLib()) : Promise.resolve(); dispatch(disposeLib());
}
disposeLibPromise.then(() => { // Let the new config into the Redux store (because initLib will read it
// Let the new config into the Redux store (because initLib will read it // from there).
// from there). const result = next(action);
next(action);
// FIXME Obviously, the following is bad design. However, I'm currently // FIXME Obviously, the following is bad design. However, I'm currently
// introducing the features base/config and base/logging and I'm trying // introducing the features base/config and base/logging and I'm trying to
// to minimize the scope of the changes while I'm attempting to preserve // minimize the scope of the changes while I'm attempting to preserve
// compatibility with the existing partially React-ified Web source code // compatibility with the existing partially React-ified Web source code and
// and what was already executing on React Native. Additionally, I do // what was already executing on React Native. Additionally, I do not care
// not care to load logging_config.js on React Native. // to load logging_config.js on React Native.
dispatch(setLoggingConfig(window.loggingConfig)); dispatch(setLoggingConfig(window.loggingConfig));
dispatch(initLib()); dispatch(initLib());
});
return result;
} }

View File

@ -1,6 +1,6 @@
/* @flow */ /* @flow */
const userAgent = navigator.userAgent; const { userAgent } = navigator;
let OS; let OS;
if (userAgent.match(/Android/i)) { if (userAgent.match(/Android/i)) {

View File

@ -172,9 +172,8 @@ export function showDesktopSharingButton(): Function {
export function showDialPadButton(show: boolean): Function { export function showDialPadButton(show: boolean): Function {
return (dispatch: Dispatch<*>) => { return (dispatch: Dispatch<*>) => {
const buttonName = 'dialpad'; const buttonName = 'dialpad';
const shouldShow = UIUtil.isButtonEnabled(buttonName) && show;
if (shouldShow) { if (show && UIUtil.isButtonEnabled(buttonName)) {
dispatch(setToolbarButton(buttonName, { dispatch(setToolbarButton(buttonName, {
hidden: false hidden: false
})); }));
@ -205,11 +204,9 @@ export function showRecordingButton(): Function {
export function showSharedVideoButton(): Function { export function showSharedVideoButton(): Function {
return (dispatch: Dispatch<*>) => { return (dispatch: Dispatch<*>) => {
const buttonName = 'sharedvideo'; const buttonName = 'sharedvideo';
const shouldShow
= UIUtil.isButtonEnabled(buttonName)
&& !config.disableThirdPartyRequests;
if (shouldShow) { if (UIUtil.isButtonEnabled(buttonName)
&& !config.disableThirdPartyRequests) {
dispatch(setToolbarButton(buttonName, { dispatch(setToolbarButton(buttonName, {
hidden: false hidden: false
})); }));
@ -218,28 +215,22 @@ export function showSharedVideoButton(): Function {
} }
/** /**
* Shows SIP call button if it's required and appropriate * Shows SIP call button if it's required and appropriate flag is passed.
* flag is passed.
* *
* @param {boolean} show - Flag showing whether to show button or not. * @param {boolean} show - Flag showing whether to show button or not.
* @returns {Function} * @returns {Function}
*/ */
export function showSIPCallButton(show: boolean): Function { export function showSIPCallButton(show: boolean): Function {
return (dispatch: Dispatch<*>) => { return (dispatch: Dispatch<*>, getState: Function) => {
const buttonName = 'sip'; const buttonName = 'sip';
// hide the button if there is a config to check for user roles, if (show
// based on the token and the the user is guest && APP.conference.sipGatewayEnabled()
const shouldShow
= APP.conference.sipGatewayEnabled()
&& UIUtil.isButtonEnabled(buttonName) && UIUtil.isButtonEnabled(buttonName)
&& show
&& (!config.enableUserRolesBasedOnToken && (!config.enableUserRolesBasedOnToken
|| !APP.tokenData.isGuest); || !getState()['features/jwt'].isGuest)) {
if (shouldShow) {
dispatch(setToolbarButton(buttonName, { dispatch(setToolbarButton(buttonName, {
hidden: !shouldShow hidden: false
})); }));
} }
}; };