fix(participants) do not preload gravatars if config is empty

Previously gravatars (external resources) were preloaded even if
disableThirdPartyRequests was set to true in the config, as the
config may be empty at the time of preloading.

Closes: #5670
Signed-off-by: Christoph Settgast <csett86@web.de>
This commit is contained in:
Christoph Settgast 2021-06-01 10:28:36 +02:00 committed by Дамян Минков
parent 06ce24527e
commit 1b200abaa7
1 changed files with 12 additions and 8 deletions

View File

@ -407,6 +407,9 @@ function _participantJoinedOrUpdated(store, next, action) {
// to the new avatar and emit out change events if necessary.
const result = next(action);
// Only run this if the config is populated, otherwise we preload external resources
// even if disableThirdPartyRequests is set to true in config
if (Object.keys(getState()['features/base/config']).length) {
const { disableThirdPartyRequests } = getState()['features/base/config'];
if (!disableThirdPartyRequests && (avatarURL || email || id || name)) {
@ -418,6 +421,7 @@ function _participantJoinedOrUpdated(store, next, action) {
dispatch(setLoadableAvatarUrl(participantId, url));
});
}
}
// Notify external listeners of potential avatarURL changes.
if (typeof APP === 'object') {