From bd5901d59cba368f8453f709f148933dbaeb635b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 4 Feb 2020 15:26:36 +0100 Subject: [PATCH] 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. --- react/features/notifications/functions.js | 2 +- react/features/presence-status/functions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/features/notifications/functions.js b/react/features/notifications/functions.js index f2664d7cc..1cbad693a 100644 --- a/react/features/notifications/functions.js +++ b/react/features/notifications/functions.js @@ -24,5 +24,5 @@ export function areThereNotifications(stateful: Object | Function) { * @returns {boolean} */ export function joinLeaveNotificationsDisabled() { - return Boolean(interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS); + return Boolean(typeof interfaceConfig !== 'undefined' && interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS); } diff --git a/react/features/presence-status/functions.js b/react/features/presence-status/functions.js index c22e4cc62..442c44524 100644 --- a/react/features/presence-status/functions.js +++ b/react/features/presence-status/functions.js @@ -8,5 +8,5 @@ declare var interfaceConfig: Object; * @returns {boolean} */ export function presenceStatusDisabled() { - return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS); + return Boolean(typeof interfaceConfig !== 'undefined' && interfaceConfig?.DISABLE_PRESENCE_STATUS); }