fix(avatar) support icons alongside cors avatars (#12280)
This commit is contained in:
parent
93406bb12c
commit
1230cebde2
|
@ -76,6 +76,6 @@ export function getInitials(s?: string) {
|
||||||
* @param {Array<string>} corsURLs - The URL pattern that matches a URL that needs to be handled with CORS.
|
* @param {Array<string>} corsURLs - The URL pattern that matches a URL that needs to be handled with CORS.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function isCORSAvatarURL(url: string | any = '', corsURLs: Array<string> = []) {
|
export function isCORSAvatarURL(url: string, corsURLs: Array<string> = []): boolean {
|
||||||
return corsURLs.some(pattern => url.startsWith(pattern));
|
return corsURLs.some(pattern => url.startsWith(pattern));
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,7 +609,8 @@ async function _getFirstLoadableAvatarUrl(participant: Participant, store: IStor
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const { corsAvatarURLs } = store.getState()['features/base/config'];
|
const { corsAvatarURLs } = store.getState()['features/base/config'];
|
||||||
const { isUsingCORS, src } = await preloadImage(url, isCORSAvatarURL(url, corsAvatarURLs));
|
const useCORS = isIconUrl(url) ? false : isCORSAvatarURL(url, corsAvatarURLs);
|
||||||
|
const { isUsingCORS, src } = await preloadImage(url, useCORS);
|
||||||
|
|
||||||
AVATAR_CHECKED_URLS.set(src, {
|
AVATAR_CHECKED_URLS.set(src, {
|
||||||
isLoadable: true,
|
isLoadable: true,
|
||||||
|
|
Loading…
Reference in New Issue