From ed8009883b1f65abab0c4ff758a16bafcdeb0077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Sat, 28 Mar 2020 20:24:27 +0100 Subject: [PATCH] avatars: ensure no remote avatar is loaded when disableThirdPartyRequests is set --- react/features/base/participants/middleware.js | 4 +++- react/features/base/participants/preloadImage.web.js | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js index 8c0ee2b872..57c0d26fd0 100644 --- a/react/features/base/participants/middleware.js +++ b/react/features/base/participants/middleware.js @@ -343,7 +343,9 @@ function _participantJoinedOrUpdated({ dispatch, getState }, next, action) { // to the new avatar and emit out change events if necessary. const result = next(action); - if (avatarURL || email || id || name) { + const { disableThirdPartyRequests } = getState()['features/base/config']; + + if (!disableThirdPartyRequests && (avatarURL || email || id || name)) { const participantId = !id && local ? getLocalParticipant(getState()).id : id; const updatedParticipant = getParticipantById(getState(), participantId); diff --git a/react/features/base/participants/preloadImage.web.js b/react/features/base/participants/preloadImage.web.js index 8e1efd5fb3..29fb2ae181 100644 --- a/react/features/base/participants/preloadImage.web.js +++ b/react/features/base/participants/preloadImage.web.js @@ -3,8 +3,6 @@ import { isIconUrl } from './functions'; -declare var config: Object; - /** * Tries to preload an image. * @@ -16,10 +14,6 @@ export function preloadImage(src: string | Object): Promise { return Promise.resolve(src); } - if (typeof config === 'object' && config.disableThirdPartyRequests) { - return Promise.reject(); - } - return new Promise((resolve, reject) => { const image = document.createElement('img');