Adds pubkey to the host filter in live events.

This commit is contained in:
Vitor Pamplona
2024-06-21 09:24:01 -04:00
parent 3fa5877840
commit 35a9c07636
@@ -60,17 +60,14 @@ class LiveActivitiesEvent(
fun hosts() = tags.filter { it.size > 3 && it[0] == "p" && it[3].equals("Host", true) }.map { it[1] } fun hosts() = tags.filter { it.size > 3 && it[0] == "p" && it[3].equals("Host", true) }.map { it[1] }
fun checkStatus(eventStatus: String?): String? { fun checkStatus(eventStatus: String?): String? =
return if (eventStatus == STATUS_LIVE && createdAt < TimeUtils.eightHoursAgo()) { if (eventStatus == STATUS_LIVE && createdAt < TimeUtils.eightHoursAgo()) {
STATUS_ENDED STATUS_ENDED
} else { } else {
eventStatus eventStatus
} }
}
fun participantsIntersect(keySet: Set<String>): Boolean { fun participantsIntersect(keySet: Set<String>): Boolean = keySet.contains(pubKey) || tags.any { it.size > 1 && it[0] == "p" && it[1] in keySet }
return tags.any { it.size > 1 && it[0] == "p" && it[1] in keySet }
}
companion object { companion object {
const val KIND = 30311 const val KIND = 30311