Revert "feat(avatars): use initials service for getting images (#2312)"
This reverts commit 2ea5ad68a5
.
This commit is contained in:
parent
1fb8697850
commit
ba28b9f17d
|
@ -24,12 +24,11 @@ declare var interfaceConfig: Object;
|
|||
* @returns {string} The URL of the image for the avatar of the specified
|
||||
* participant.
|
||||
*/
|
||||
export function getAvatarURL({ avatarID, avatarURL, email, id, name }: {
|
||||
export function getAvatarURL({ avatarID, avatarURL, email, id }: {
|
||||
avatarID: string,
|
||||
avatarURL: string,
|
||||
email: string,
|
||||
id: string,
|
||||
name: string
|
||||
id: string
|
||||
}) {
|
||||
// If disableThirdPartyRequests disables third-party avatar services, we are
|
||||
// restricted to a stock image of ours.
|
||||
|
@ -69,8 +68,9 @@ export function getAvatarURL({ avatarID, avatarURL, email, id, name }: {
|
|||
if (urlPrefix) {
|
||||
urlSuffix = interfaceConfig.RANDOM_AVATAR_URL_SUFFIX;
|
||||
} else {
|
||||
urlPrefix = 'https://avatar-cdn.jitsi.net/';
|
||||
urlSuffix = `/${_getInitials(name) || ' '}/200/avatar.png`;
|
||||
// Otherwise, use a default (meeples, of course).
|
||||
urlPrefix = 'https://abotars.jitsi.net/meeple/';
|
||||
urlSuffix = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,26 +223,3 @@ function _getAllParticipants(stateful) {
|
|||
? stateful
|
||||
: toState(stateful)['features/base/participants'] || []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the initials from a name, assuming a westernized name.
|
||||
*
|
||||
* @param {string} name - The name from which to parse initials.
|
||||
* @private
|
||||
* @returns {string}
|
||||
*/
|
||||
function _getInitials(name) {
|
||||
if (!name) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const nameParts = name.toUpperCase().split(' ');
|
||||
const firstName = nameParts[0];
|
||||
let initials = firstName[0];
|
||||
|
||||
if (nameParts.length > 1) {
|
||||
initials += nameParts[nameParts.length - 1];
|
||||
}
|
||||
|
||||
return initials;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue