Adds a lastReportedTime field (to be used with Since in the websocket filter) for Users with too many reports.
This commit is contained in:
@@ -13,8 +13,10 @@ import java.util.concurrent.atomic.AtomicBoolean
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
import kotlinx.coroutines.NonCancellable
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import nostr.postr.events.ContactListEvent
|
import nostr.postr.events.ContactListEvent
|
||||||
import nostr.postr.events.MetadataEvent
|
import nostr.postr.events.MetadataEvent
|
||||||
import nostr.postr.toNpub
|
import nostr.postr.toNpub
|
||||||
@@ -43,6 +45,7 @@ class User(val pubkeyHex: String) {
|
|||||||
|
|
||||||
var reports = mapOf<User, Set<Note>>()
|
var reports = mapOf<User, Set<Note>>()
|
||||||
private set
|
private set
|
||||||
|
var latestReportTime: Long = 0
|
||||||
|
|
||||||
var zaps = mapOf<Note, Note?>()
|
var zaps = mapOf<Note, Note?>()
|
||||||
private set
|
private set
|
||||||
@@ -140,6 +143,11 @@ class User(val pubkeyHex: String) {
|
|||||||
reports = reports + Pair(author, (reports[author] ?: emptySet()) + note)
|
reports = reports + Pair(author, (reports[author] ?: emptySet()) + note)
|
||||||
liveReports.invalidateData()
|
liveReports.invalidateData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val reportTime = note.event?.createdAt ?: 0
|
||||||
|
if (reportTime > latestReportTime) {
|
||||||
|
latestReportTime = reportTime
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addZap(zapRequest: Note, zap: Note?) {
|
fun addZap(zapRequest: Note, zap: Note?) {
|
||||||
|
|||||||
Reference in New Issue
Block a user