浏览代码

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

Fix TypeError: Cannot read property 'isGuest' of undefined
master
Дамян Минков 8 年前
父节点
当前提交
ec881e0fd0

+ 10
- 10
package.json 查看文件

@@ -29,12 +29,12 @@
29 29
     "bootstrap": "3.1.1",
30 30
     "es6-iterator": "2.0.1",
31 31
     "es6-symbol": "3.1.1",
32
-    "i18next": "8.0.0",
32
+    "i18next": "8.2.1",
33 33
     "i18next-browser-languagedetector": "1.0.1",
34 34
     "i18next-xhr-backend": "1.4.1",
35 35
     "jitsi-meet-logger": "jitsi/jitsi-meet-logger",
36 36
     "jquery": "2.1.4",
37
-    "jquery-contextmenu": "2.4.3",
37
+    "jquery-contextmenu": "2.4.5",
38 38
     "jquery-i18next": "1.2.0",
39 39
     "jQuery-Impromptu": "trentrichardson/jQuery-Impromptu#v6.0.0",
40 40
     "jquery-ui": "1.10.5",
@@ -45,14 +45,14 @@
45 45
     "postis": "2.2.0",
46 46
     "react": "15.4.2",
47 47
     "react-dom": "15.4.2",
48
-    "react-i18next": "3.1.0",
48
+    "react-i18next": "4.1.0",
49 49
     "react-native": "0.42.3",
50
-    "react-native-background-timer": "1.0.0",
51
-    "react-native-immersive": "0.0.4",
52
-    "react-native-keep-awake": "2.0.3",
50
+    "react-native-background-timer": "1.0.1",
51
+    "react-native-immersive": "0.0.5",
52
+    "react-native-keep-awake": "2.0.4",
53 53
     "react-native-locale-detector": "1.0.1",
54 54
     "react-native-prompt": "1.0.0",
55
-    "react-native-vector-icons": "4.0.1",
55
+    "react-native-vector-icons": "4.1.1",
56 56
     "react-native-webrtc": "jitsi/react-native-webrtc",
57 57
     "react-redux": "5.0.4",
58 58
     "redux": "3.6.0",
@@ -74,11 +74,11 @@
74 74
     "babel-preset-react": "6.24.1",
75 75
     "babel-preset-stage-1": "6.24.1",
76 76
     "clean-css": "3.4.25",
77
-    "css-loader": "0.28.0",
77
+    "css-loader": "0.28.1",
78 78
     "eslint": "3.19.0",
79 79
     "eslint-plugin-flowtype": "2.30.4",
80 80
     "eslint-plugin-import": "2.2.0",
81
-    "eslint-plugin-jsdoc": "3.0.2",
81
+    "eslint-plugin-jsdoc": "3.1.0",
82 82
     "eslint-plugin-react": "6.10.3",
83 83
     "eslint-plugin-react-native": "2.3.2",
84 84
     "expose-loader": "0.7.3",
@@ -91,7 +91,7 @@
91 91
     "node-sass": "3.13.1",
92 92
     "precommit-hook": "3.0.0",
93 93
     "string-replace-loader": "1.2.0",
94
-    "style-loader": "0.16.1",
94
+    "style-loader": "0.17.0",
95 95
     "webpack": "1.14.0",
96 96
     "webpack-dev-server": "1.16.3"
97 97
   },

+ 7
- 0
react/features/base/config/reducer.js 查看文件

@@ -58,6 +58,13 @@ function _setConfig(state, action) {
58 58
         // The config of INITIAL_STATE is meant to override the config
59 59
         // downloaded from the Jitsi Meet deployment because the former contains
60 60
         // values that are mandatory.
61
+        //
62
+        // FIXME At the time of this writing the hard-coded overriding values
63
+        // are specific to mobile/React Native but the source code here is
64
+        // executed on Web/React as well. The latter is not a practical problem
65
+        // right now because the rest of the Web/React source code does not read
66
+        // the overridden properties/values, it still relies on the global
67
+        // variable config.
61 68
         ...INITIAL_STATE
62 69
     };
63 70
 }

+ 1
- 7
react/features/base/lib-jitsi-meet/actions.js 查看文件

@@ -21,15 +21,9 @@ export function disposeLib() {
21 21
     return (dispatch: Dispatch<*>) => {
22 22
         dispatch({ type: LIB_WILL_DISPOSE });
23 23
 
24
-        // XXX We're wrapping it with Promise because:
25
-        // a) to be better aligned with initLib() method which is async;
26
-        // b) as currently there is no implementation for it in lib-jitsi-meet
27
-        //    and there is a big chance it will be async.
28 24
         // TODO Currently, lib-jitsi-meet doesn't have the functionality to
29 25
         // dispose itself.
30
-        return (
31
-            Promise.resolve()
32
-                .then(() => dispatch({ type: LIB_DID_DISPOSE })));
26
+        dispatch({ type: LIB_DID_DISPOSE });
33 27
     };
34 28
 }
35 29
 

+ 19
- 18
react/features/base/lib-jitsi-meet/middleware.js 查看文件

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

+ 1
- 1
react/features/base/react/Platform.web.js 查看文件

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

+ 9
- 18
react/features/toolbox/actions.web.js 查看文件

@@ -172,9 +172,8 @@ export function showDesktopSharingButton(): Function {
172 172
 export function showDialPadButton(show: boolean): Function {
173 173
     return (dispatch: Dispatch<*>) => {
174 174
         const buttonName = 'dialpad';
175
-        const shouldShow = UIUtil.isButtonEnabled(buttonName) && show;
176 175
 
177
-        if (shouldShow) {
176
+        if (show && UIUtil.isButtonEnabled(buttonName)) {
178 177
             dispatch(setToolbarButton(buttonName, {
179 178
                 hidden: false
180 179
             }));
@@ -205,11 +204,9 @@ export function showRecordingButton(): Function {
205 204
 export function showSharedVideoButton(): Function {
206 205
     return (dispatch: Dispatch<*>) => {
207 206
         const buttonName = 'sharedvideo';
208
-        const shouldShow
209
-            = UIUtil.isButtonEnabled(buttonName)
210
-                && !config.disableThirdPartyRequests;
211 207
 
212
-        if (shouldShow) {
208
+        if (UIUtil.isButtonEnabled(buttonName)
209
+                && !config.disableThirdPartyRequests) {
213 210
             dispatch(setToolbarButton(buttonName, {
214 211
                 hidden: false
215 212
             }));
@@ -218,28 +215,22 @@ export function showSharedVideoButton(): Function {
218 215
 }
219 216
 
220 217
 /**
221
- * Shows SIP call button if it's required and appropriate
222
- * flag is passed.
218
+ * Shows SIP call button if it's required and appropriate flag is passed.
223 219
  *
224 220
  * @param {boolean} show - Flag showing whether to show button or not.
225 221
  * @returns {Function}
226 222
  */
227 223
 export function showSIPCallButton(show: boolean): Function {
228
-    return (dispatch: Dispatch<*>) => {
224
+    return (dispatch: Dispatch<*>, getState: Function) => {
229 225
         const buttonName = 'sip';
230 226
 
231
-        // hide the button if there is a config to check for user roles,
232
-        // based on the token and the the user is guest
233
-        const shouldShow
234
-            = APP.conference.sipGatewayEnabled()
227
+        if (show
228
+                && APP.conference.sipGatewayEnabled()
235 229
                 && UIUtil.isButtonEnabled(buttonName)
236
-                && show
237 230
                 && (!config.enableUserRolesBasedOnToken
238
-                        || !APP.tokenData.isGuest);
239
-
240
-        if (shouldShow) {
231
+                    || !getState()['features/jwt'].isGuest)) {
241 232
             dispatch(setToolbarButton(buttonName, {
242
-                hidden: !shouldShow
233
+                hidden: false
243 234
             }));
244 235
         }
245 236
     };

正在加载...
取消
保存