浏览代码

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>
j8
Christoph Settgast 3 年前
父节点
当前提交
1b200abaa7
共有 1 个文件被更改,包括 14 次插入10 次删除
  1. 14
    10
      react/features/base/participants/middleware.js

+ 14
- 10
react/features/base/participants/middleware.js 查看文件

@@ -407,16 +407,20 @@ function _participantJoinedOrUpdated(store, next, action) {
407 407
     // to the new avatar and emit out change events if necessary.
408 408
     const result = next(action);
409 409
 
410
-    const { disableThirdPartyRequests } = getState()['features/base/config'];
411
-
412
-    if (!disableThirdPartyRequests && (avatarURL || email || id || name)) {
413
-        const participantId = !id && local ? getLocalParticipant(getState()).id : id;
414
-        const updatedParticipant = getParticipantById(getState(), participantId);
415
-
416
-        getFirstLoadableAvatarUrl(updatedParticipant, store)
417
-            .then(url => {
418
-                dispatch(setLoadableAvatarUrl(participantId, url));
419
-            });
410
+    // Only run this if the config is populated, otherwise we preload external resources
411
+    // even if disableThirdPartyRequests is set to true in config
412
+    if (Object.keys(getState()['features/base/config']).length) {
413
+        const { disableThirdPartyRequests } = getState()['features/base/config'];
414
+
415
+        if (!disableThirdPartyRequests && (avatarURL || email || id || name)) {
416
+            const participantId = !id && local ? getLocalParticipant(getState()).id : id;
417
+            const updatedParticipant = getParticipantById(getState(), participantId);
418
+
419
+            getFirstLoadableAvatarUrl(updatedParticipant, store)
420
+                .then(url => {
421
+                    dispatch(setLoadableAvatarUrl(participantId, url));
422
+                });
423
+        }
420 424
     }
421 425
 
422 426
     // Notify external listeners of potential avatarURL changes.

正在加载...
取消
保存