avoiding deprecated .put api

This commit is contained in:
Vitor Pamplona
2025-04-24 17:36:27 -04:00
parent 07c3a3ffe5
commit ecebc68e11
2 changed files with 11 additions and 4 deletions

View File

@@ -62,9 +62,16 @@ class SinceAuthorPerRelayFilter(
if (isNotEmpty()) {
val jsonObjectPerRelayAuthors = factory.objectNode()
entries.forEach { relayAuthorPairs ->
jsonObjectPerRelayAuthors.put(relayAuthorPairs.key, factory.arrayNode(relayAuthorPairs.value.size).apply { relayAuthorPairs.value.forEach { add(it) } })
jsonObjectPerRelayAuthors.replace(
relayAuthorPairs.key,
factory.arrayNode(relayAuthorPairs.value.size).apply {
relayAuthorPairs.value.forEach {
add(it)
}
obj.put("authors", jsonObjectPerRelayAuthors)
},
)
}
obj.replace("authors", jsonObjectPerRelayAuthors)
}
}
@@ -74,7 +81,7 @@ class SinceAuthorPerRelayFilter(
entries.forEach { sincePairs ->
jsonObjectSince.put(sincePairs.key, "${sincePairs.value}")
}
obj.put("since", jsonObjectSince)
obj.replace("since", jsonObjectSince)
}
}
return EventMapper.mapper.writeValueAsString(obj)

View File

@@ -61,7 +61,7 @@ class SincePerRelayFilter(
entries.forEach { sincePairs ->
jsonObjectSince.put(sincePairs.key, "${sincePairs.value}")
}
obj.put("since", jsonObjectSince)
obj.replace("since", jsonObjectSince)
}
}
return EventMapper.toJson(obj)