mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Fix disambiguated with empty senderName
This commit is contained in:
parent
035359cb35
commit
101057520b
1 changed files with 6 additions and 13 deletions
|
@ -62,17 +62,10 @@ data class TimelineEvent(
|
|||
}
|
||||
|
||||
fun getDisambiguatedDisplayName(): String {
|
||||
val disambiguated = if (isUniqueDisplayName) {
|
||||
senderName
|
||||
} else {
|
||||
senderName?.let { name ->
|
||||
"$name (${root.senderId})"
|
||||
}
|
||||
}
|
||||
return if (disambiguated.isNullOrBlank()) {
|
||||
root.senderId ?: ""
|
||||
} else {
|
||||
disambiguated
|
||||
return when {
|
||||
senderName.isNullOrBlank() -> root.senderId ?: ""
|
||||
isUniqueDisplayName -> senderName
|
||||
else -> "$senderName (${root.senderId})"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +100,7 @@ fun TimelineEvent.getEditedEventId(): String? {
|
|||
* Get last MessageContent, after a possible edition
|
||||
*/
|
||||
fun TimelineEvent.getLastMessageContent(): MessageContent? = annotations?.editSummary?.aggregatedContent?.toModel()
|
||||
?: root.getClearContent().toModel()
|
||||
?: root.getClearContent().toModel()
|
||||
|
||||
/**
|
||||
* Get last Message body, after a possible edition
|
||||
|
@ -117,7 +110,7 @@ fun TimelineEvent.getLastMessageBody(): String? {
|
|||
|
||||
if (lastMessageContent != null) {
|
||||
return lastMessageContent.newContent?.toModel<MessageContent>()?.body
|
||||
?: lastMessageContent.body
|
||||
?: lastMessageContent.body
|
||||
}
|
||||
|
||||
return null
|
||||
|
|
Loading…
Reference in a new issue