mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix matching of multiple emojis #1593
This commit is contained in:
parent
eaa2f681ac
commit
855065c201
@ -128,13 +128,14 @@ define([
|
||||
var getPrettyInitials = MT.getPrettyInitials = function (name) {
|
||||
const match = name.match(emojiRegex);
|
||||
//if the emoji is the first character, it will become the avatar
|
||||
if (match && name.indexOf(match) === 0) {
|
||||
if (match && name.startsWith(match[0])) {
|
||||
return match[0];
|
||||
}
|
||||
else {
|
||||
name = name.replace(emojiRegex, '');
|
||||
name = name.trim();
|
||||
}
|
||||
var parts = name.trim().split(/\s+/);
|
||||
var parts = name.split(/\s+/);
|
||||
var text;
|
||||
if (parts.length > 1) {
|
||||
text = parts.slice(0, 2).map(Util.getFirstCharacter).join('');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user