Use id to get first letter, if display name is empty

This commit is contained in:
Benoit Marty 2019-12-16 10:56:25 +01:00
parent c9ed95ed21
commit cecef5b8da
1 changed files with 3 additions and 5 deletions

View File

@ -95,9 +95,8 @@ sealed class MatrixItem(
}
fun firstLetterOfDisplayName(): String {
return displayName
?.takeIf { it.isNotBlank() }
?.let { dn ->
return getBestName()
.let { dn ->
var startIndex = 0
val initial = dn[startIndex]
@ -124,8 +123,7 @@ sealed class MatrixItem(
dn.substring(startIndex, startIndex + length)
}
?.toUpperCase(Locale.ROOT)
?: " "
.toUpperCase(Locale.ROOT)
}