Display non-Ascii avatar

This commit is contained in:
Julien Wadel 2023-02-06 15:27:19 +01:00
parent c26e895e18
commit 209ee49724
2 changed files with 12 additions and 6 deletions

View file

@ -11,7 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- File viewer in chats (Image/Animated Image/Video/Texts) with the option to export the file. - File viewer in chats (Image/Animated Image/Video/Texts) with the option to export the file.
- Accept/decline CLI commands. - Accept/decline CLI commands.
## 5.0.10 - undefined ## 5.0.11 - udnefined
### Fixed
- Display of non-Ascii avatar
## 5.0.10 - 2023-02-02
### Fixed ### Fixed
- Remove blank notification when declining incoming call. - Remove blank notification when declining incoming call.

View file

@ -33,14 +33,15 @@ Item {
} }
function _computeInitials () { function _computeInitials () {
// Do not use charAt from string because it doesn't support all UTF8 characters.
var result = username.match(_initialsRegex) var result = username.match(_initialsRegex)
if (!result) { if (!result) {
return username.length > 0 ? username.charAt(0).toUpperCase() : '' var usernameArray = Array.from(username)
return usernameArray.length > 0 ? usernameArray[0].toUpperCase() : ''
} }
return Array.from(result[1])[0].toUpperCase() + (
return result[1].charAt(0).toUpperCase() + ( result.length > 1 && result[2].length > 0
result[2] != null ? Array.from(result[2])[0].toUpperCase()
? result[2].charAt(0).toUpperCase()
: '' : ''
) )
} }