Fixes "null" strings on profile fields.

This commit is contained in:
Vitor Pamplona 2024-11-27 10:24:09 -05:00
parent 88082b1ba3
commit 9a0c998654
3 changed files with 4 additions and 2 deletions

View File

@ -1016,7 +1016,7 @@ private fun DrawAdditionalInfo(
fontSize = 25.sp,
)
Spacer(StdHorzSpacer)
user.info?.pronouns.let {
user.info?.pronouns?.let {
Text(
text = "($it)",
modifier = Modifier,

View File

@ -465,6 +465,8 @@ class UserMetadata {
fun profilePicture(): String? = picture
fun cleanBlankNames() {
if (pronouns == "null") pronouns = null
if (picture?.isNotEmpty() == true) picture = picture?.trim()
if (nip05?.isNotEmpty() == true) nip05 = nip05?.trim()
if (displayName?.isNotEmpty() == true) displayName = displayName?.trim()

View File

@ -283,7 +283,7 @@ class MetadataEvent(
key: String,
value: String,
) {
if (value.isBlank()) {
if (value.isBlank() || value == "null") {
currentJson.remove(key)
} else {
currentJson.put(key, value.trim())