Browse Source

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.
j8
Saúl Ibarra Corretgé 5 years ago
parent
commit
bd5901d59c

+ 1
- 1
react/features/notifications/functions.js View File

@@ -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 View File

@@ -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
 }

Loading…
Cancel
Save