mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 09:46:35 +02:00
Trimming User Metadata fields to avoid crashes when using them
This commit is contained in:
@@ -49,17 +49,17 @@ class NewUserMetadataViewModel: ViewModel() {
|
||||
} else {
|
||||
ObjectMapper().createObjectNode()
|
||||
}
|
||||
currentJson.put("name", userName.value)
|
||||
currentJson.put("username", userName.value)
|
||||
currentJson.put("display_name", displayName.value)
|
||||
currentJson.put("displayName", displayName.value)
|
||||
currentJson.put("picture", picture.value)
|
||||
currentJson.put("banner", banner.value)
|
||||
currentJson.put("website", website.value)
|
||||
currentJson.put("about", about.value)
|
||||
currentJson.put("nip05", nip05.value)
|
||||
currentJson.put("lud16", lnAddress.value)
|
||||
currentJson.put("lud06", lnURL.value)
|
||||
currentJson.put("name", userName.value.trim())
|
||||
currentJson.put("username", userName.value.trim())
|
||||
currentJson.put("display_name", displayName.value.trim())
|
||||
currentJson.put("displayName", displayName.value.trim())
|
||||
currentJson.put("picture", picture.value.trim())
|
||||
currentJson.put("banner", banner.value.trim())
|
||||
currentJson.put("website", website.value.trim())
|
||||
currentJson.put("about", about.value.trim())
|
||||
currentJson.put("nip05", nip05.value.trim())
|
||||
currentJson.put("lud16", lnAddress.value.trim())
|
||||
currentJson.put("lud06", lnURL.value.trim())
|
||||
|
||||
val writer = StringWriter()
|
||||
ObjectMapper().writeValue(writer, currentJson)
|
||||
|
@@ -25,7 +25,7 @@ class AccountViewModel(private val account: Account): ViewModel() {
|
||||
}
|
||||
|
||||
fun zap(note: Note, amount: Long, message: String, context: Context, onError: (String) -> Unit) {
|
||||
val lud16 = note.author?.info?.lud16
|
||||
val lud16 = note.author?.info?.lud16?.trim()
|
||||
|
||||
if (lud16.isNullOrBlank()) {
|
||||
onError("User does not have a lightning address setup to receive sats")
|
||||
|
@@ -378,7 +378,7 @@ private fun DrawAdditionalInfo(baseUser: User, account: Account) {
|
||||
|
||||
var ZapExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
val lud16 = user.info.lud16
|
||||
val lud16 = user.info.lud16?.trim()
|
||||
|
||||
if (!lud16.isNullOrEmpty()) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
|
Reference in New Issue
Block a user