瀏覽代碼

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
  * @returns {boolean}
24
  * @returns {boolean}
25
  */
25
  */
26
 export function joinLeaveNotificationsDisabled() {
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
  * @returns {boolean}
8
  * @returns {boolean}
9
  */
9
  */
10
 export function presenceStatusDisabled() {
10
 export function presenceStatusDisabled() {
11
-    return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS);
11
+    return Boolean(typeof interfaceConfig !== 'undefined' && interfaceConfig?.DISABLE_PRESENCE_STATUS);
12
 }
12
 }

Loading…
取消
儲存