Slightly improving the threading for badges.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user