Adds a lastReportedTime field (to be used with Since in the websocket filter) for Users with too many reports.

pull/141/head
Vitor Pamplona 2023-02-18 19:14:27 -05:00
rodzic de2ec503da
commit 0914a7b68c
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -13,8 +13,10 @@ import java.util.concurrent.atomic.AtomicBoolean
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import nostr.postr.events.ContactListEvent
import nostr.postr.events.MetadataEvent
import nostr.postr.toNpub
@ -43,6 +45,7 @@ class User(val pubkeyHex: String) {
var reports = mapOf<User, Set<Note>>()
private set
var latestReportTime: Long = 0
var zaps = mapOf<Note, Note?>()
private set
@ -140,6 +143,11 @@ class User(val pubkeyHex: String) {
reports = reports + Pair(author, (reports[author] ?: emptySet()) + note)
liveReports.invalidateData()
}
val reportTime = note.event?.createdAt ?: 0
if (reportTime > latestReportTime) {
latestReportTime = reportTime
}
}
fun addZap(zapRequest: Note, zap: Note?) {