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.
This commit is contained in:
Saúl Ibarra Corretgé
2020-02-04 15:51:59 +01:00
committed by Saúl Ibarra Corretgé
parent 306c8ba8c2
commit bd5901d59c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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);
}