diff --git a/www/common/inner/common-mediatag.js b/www/common/inner/common-mediatag.js index 5c059aae5..a7a69e4de 100644 --- a/www/common/inner/common-mediatag.js +++ b/www/common/inner/common-mediatag.js @@ -123,8 +123,19 @@ define([ if (!seed) { return; } return ANIMALS[seed % ANIMALS.length] || ''; }; - + //this regex identifies both discord and unicode emojis (with optional skin tone modifiers) and complex zwj emoji sequences + const emojiWithZWJRegex = /(?:\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?(?:\u200D\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?)*|\p{Extended_Pictographic})/gu; var getPrettyInitials = MT.getPrettyInitials = function (name) { + let matches = name.match(emojiWithZWJRegex); + if (matches && name.startsWith(matches[0])) { + return matches[0]; + } + else { + //this is for removing all trailing white characters and unnecessary/redundant emojis + name = name.replace(emojiWithZWJRegex, ''); + name = name.replace(/\uFE0F/g, '').replace(/\u200D/g, '').replace(/\u2060/g, ''); + name = name.trim(); + } var parts = name.split(/\s+/); var text; if (parts.length > 1) { diff --git a/www/teams/app-team.less b/www/teams/app-team.less index 184a3b5a3..493d78990 100644 --- a/www/teams/app-team.less +++ b/www/teams/app-team.less @@ -108,7 +108,7 @@ } } .cp-team-cat-header { - justify-content: center; + justify-content: left; background-color: transparent !important; box-shadow: none !important; .avatar_main(30px); @@ -118,6 +118,7 @@ } media-tag, .cp-avatar-default { margin-right: 3px; + flex-shrink: 0; } media-tag { order: -1; @@ -125,7 +126,12 @@ cursor: default !important; font-size: 18px; span.cp-sidebarlayout-category-name { + max-width: 12rem; padding-left: 5px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: 0; } } .cp-team-cat-chat {