|
@@ -1,6 +1,7 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import { getGravatarURL } from '@jitsi/js-utils/avatar';
|
|
4
|
+import type { Store } from 'redux';
|
4
|
5
|
|
5
|
6
|
import { JitsiParticipantConnectionStatus } from '../lib-jitsi-meet';
|
6
|
7
|
import { MEDIA_TYPE, shouldRenderVideoTrack } from '../media';
|
|
@@ -23,30 +24,35 @@ declare var interfaceConfig: Object;
|
23
|
24
|
*/
|
24
|
25
|
const AVATAR_QUEUE = [];
|
25
|
26
|
const AVATAR_CHECKED_URLS = new Map();
|
26
|
|
-/* eslint-disable arrow-body-style */
|
|
27
|
+/* eslint-disable arrow-body-style, no-unused-vars */
|
27
|
28
|
const AVATAR_CHECKER_FUNCTIONS = [
|
28
|
|
- participant => {
|
|
29
|
+ (participant, _) => {
|
29
|
30
|
return participant && participant.isJigasi ? JIGASI_PARTICIPANT_ICON : null;
|
30
|
31
|
},
|
31
|
|
- participant => {
|
|
32
|
+ (participant, _) => {
|
32
|
33
|
return participant && participant.avatarURL ? participant.avatarURL : null;
|
33
|
34
|
},
|
34
|
|
- participant => {
|
35
|
|
- return participant && participant.email ? getGravatarURL(participant.email) : null;
|
|
35
|
+ (participant, store) => {
|
|
36
|
+ if (participant && participant.email) {
|
|
37
|
+ return getGravatarURL(participant.email, store.getState()['features/base/config'].gravatarBaseURL);
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+ return null;
|
36
|
41
|
}
|
37
|
42
|
];
|
38
|
|
-/* eslint-enable arrow-body-style */
|
|
43
|
+/* eslint-enable arrow-body-style, no-unused-vars */
|
39
|
44
|
|
40
|
45
|
/**
|
41
|
46
|
* Resolves the first loadable avatar URL for a participant.
|
42
|
47
|
*
|
43
|
48
|
* @param {Object} participant - The participant to resolve avatars for.
|
|
49
|
+ * @param {Store} store - Redux store.
|
44
|
50
|
* @returns {Promise}
|
45
|
51
|
*/
|
46
|
|
-export function getFirstLoadableAvatarUrl(participant: Object) {
|
|
52
|
+export function getFirstLoadableAvatarUrl(participant: Object, store: Store<any, any>) {
|
47
|
53
|
const deferred = createDeferred();
|
48
|
54
|
const fullPromise = deferred.promise
|
49
|
|
- .then(() => _getFirstLoadableAvatarUrl(participant))
|
|
55
|
+ .then(() => _getFirstLoadableAvatarUrl(participant, store))
|
50
|
56
|
.then(src => {
|
51
|
57
|
|
52
|
58
|
if (AVATAR_QUEUE.length) {
|
|
@@ -402,11 +408,12 @@ export function figureOutMutedWhileDisconnectedStatus(
|
402
|
408
|
* Resolves the first loadable avatar URL for a participant.
|
403
|
409
|
*
|
404
|
410
|
* @param {Object} participant - The participant to resolve avatars for.
|
|
411
|
+ * @param {Store} store - Redux store.
|
405
|
412
|
* @returns {?string}
|
406
|
413
|
*/
|
407
|
|
-async function _getFirstLoadableAvatarUrl(participant) {
|
|
414
|
+async function _getFirstLoadableAvatarUrl(participant, store) {
|
408
|
415
|
for (let i = 0; i < AVATAR_CHECKER_FUNCTIONS.length; i++) {
|
409
|
|
- const url = AVATAR_CHECKER_FUNCTIONS[i](participant);
|
|
416
|
+ const url = AVATAR_CHECKER_FUNCTIONS[i](participant, store);
|
410
|
417
|
|
411
|
418
|
if (url) {
|
412
|
419
|
if (AVATAR_CHECKED_URLS.has(url)) {
|