Bläddra i källkod

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 år sedan
förälder
incheckning
bd5901d59c

+ 1
- 1
react/features/notifications/functions.js Visa fil

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 Visa fil

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
 }

Laddar…
Avbryt
Spara