浏览代码

notifications,presence-status: check if interfaceConfig is declared

Protectt ourselves against interfaceConfig being undeclared. typeof
interfaceConfig will return "undefined", but that's different than having some
window.interfaceConfig = undefined, even though the valus is the same. The
former will give a ReferenceError.
master
Saúl Ibarra Corretgé 5 年前
父节点
当前提交
bd5901d59c
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      react/features/notifications/functions.js
  2. 1
    1
      react/features/presence-status/functions.js

+ 1
- 1
react/features/notifications/functions.js 查看文件

@@ -24,5 +24,5 @@ export function areThereNotifications(stateful: Object | Function) {
24 24
  * @returns {boolean}
25 25
  */
26 26
 export function joinLeaveNotificationsDisabled() {
27
-    return Boolean(interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS);
27
+    return Boolean(typeof interfaceConfig !== 'undefined' && interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS);
28 28
 }

+ 1
- 1
react/features/presence-status/functions.js 查看文件

@@ -8,5 +8,5 @@ declare var interfaceConfig: Object;
8 8
  * @returns {boolean}
9 9
  */
10 10
 export function presenceStatusDisabled() {
11
-    return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS);
11
+    return Boolean(typeof interfaceConfig !== 'undefined' && interfaceConfig?.DISABLE_PRESENCE_STATUS);
12 12
 }

正在加载...
取消
保存