Skip to content

Commit

Permalink
Fixes "null" strings on profile fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Nov 27, 2024
1 parent 88082b1 commit 9a0c998
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 9a0c998

Please sign in to comment.