show contact email as its name, if real name and oganization are empty

This commit is contained in:
tibbi 2018-10-27 17:12:30 +02:00
parent f1ab9b1e0f
commit f6347db55d
1 changed files with 7 additions and 3 deletions

View File

@ -86,9 +86,13 @@ data class Contact(val id: Int, var prefix: String, var firstName: String, var m
val suffixComma = if (suffix.isEmpty()) "" else ", $suffix" val suffixComma = if (suffix.isEmpty()) "" else ", $suffix"
val fullName = "$prefix $firstPart $lastPart$suffixComma".trim() val fullName = "$prefix $firstPart $lastPart$suffixComma".trim()
return if (fullName.isEmpty()) { return if (fullName.isEmpty()) {
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, " if (organization.isEmpty()) {
fullOrganization += organization.company emails.firstOrNull()?.value ?: ""
fullOrganization.trim().trimEnd(',') } else {
var fullOrganization = if (organization.jobPosition.isEmpty()) "" else "${organization.jobPosition}, "
fullOrganization += organization.company
fullOrganization.trim().trimEnd(',')
}
} else { } else {
fullName fullName
} }