Slightly improving the threading for badges.

This commit is contained in:
Vitor Pamplona
2024-05-21 14:50:36 -04:00
parent 24be6cd90d
commit 7acdf56e68
4 changed files with 20 additions and 27 deletions
@@ -33,21 +33,17 @@ class BadgeProfilesEvent(
content: String,
sig: HexKey,
) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
fun badgeAwardEvents() = tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) }
fun badgeAwardEvents() = taggedEvents()
fun badgeAwardDefinitions() =
tags
.filter { it.firstOrNull() == "a" }
.mapNotNull {
val aTagValue = it.getOrNull(1)
val relay = it.getOrNull(2)
if (aTagValue != null) ATag.parse(aTagValue, relay) else null
}
fun badgeAwardDefinitions() = taggedAddresses()
companion object {
const val KIND = 30008
const val STANDARD_D_TAG = "profile_badges"
const val ALT = "List of accepted badges by the author"
private const val STANDARD_D_TAG = "profile_badges"
private const val ALT = "List of accepted badges by the author"
fun createAddressTag(pubKey: HexKey): ATag {
return ATag(KIND, pubKey, STANDARD_D_TAG, null)
}
}
}