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

View File

@ -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 checkStatus(eventStatus: String?): String? {
return if (eventStatus == STATUS_LIVE && createdAt < TimeUtils.eightHoursAgo()) {
fun checkStatus(eventStatus: String?): String? =
if (eventStatus == STATUS_LIVE && createdAt < TimeUtils.eightHoursAgo()) {
STATUS_ENDED
} else {
eventStatus
}
}
fun participantsIntersect(keySet: Set<String>): Boolean {
return tags.any { it.size > 1 && it[0] == "p" && it[1] in keySet }
}
fun participantsIntersect(keySet: Set<String>): Boolean = keySet.contains(pubKey) || tags.any { it.size > 1 && it[0] == "p" && it[1] in keySet }
companion object {
const val KIND = 30311