Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(base/avatar): Update the avatar to show the first and last name letters rather than first and second name (#15732)

Wilson Furtadoa39d8d35a281
diff --git a/react/features/base/avatar/functions.ts b/react/features/base/avatar/functions.ts
index 030b8066e7..cb2a6b398d 100644
--- a/react/features/base/avatar/functions.ts
+++ b/react/features/base/avatar/functions.ts
@@ -64,9 +64,9 @@ function getFirstGraphemeUpper(word: string) {
export function getInitials(s?: string) {
// We don't want to use the domain part of an email address, if it is one
const initialsBasis = split(s, '@')[0];
- const [ firstWord, secondWord ] = initialsBasis.split(wordSplitRegex).filter(Boolean);
+ const [ firstWord, ...remainingWords ] = initialsBasis.split(wordSplitRegex).filter(Boolean);
- return getFirstGraphemeUpper(firstWord) + getFirstGraphemeUpper(secondWord);
+ return getFirstGraphemeUpper(firstWord) + getFirstGraphemeUpper(remainingWords.pop() || '');
}
/**