fix(nests): evict author from prior room when presence moves to a new room
kind-10312 is replaceable per author, but the room a presence points to (`a`-tag) can change when a speaker hops between rooms. The replaceable cache only swaps the addressable's content -- it doesn't know which channel the old version was attached to, so the prior room kept the stale entry in both `notes` and the new `presenceNotes` index. NestsFeedFilter would then falsely surface the prior room as "live" via that author until the entry dropped out of the freshness window. Capture the prior room from the existing addressable before consumeBaseReplaceable swaps it. When the new event is a true replacement (createdAt > prior) and the room differs, drop the author from the prior channel's presenceNotes and remove the prior version note from its main notes index.
This commit is contained in:
+11
@@ -60,6 +60,17 @@ class LiveActivitiesChannel(
|
||||
presenceNotes.put(author, note)
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop an author's presence entry. Called by `LocalCache` when a
|
||||
* replaceable kind-10312 from this author lands in a *different*
|
||||
* room — without this eviction, the old room would keep surfacing
|
||||
* as "live" via stale presence until it drops out of the
|
||||
* freshness window.
|
||||
*/
|
||||
fun removePresenceNote(author: HexKey) {
|
||||
presenceNotes.remove(author)
|
||||
}
|
||||
|
||||
fun address() = address
|
||||
|
||||
override fun relays() = info?.allRelayUrls()?.toSet()?.ifEmpty { null } ?: super.relays()
|
||||
|
||||
Reference in New Issue
Block a user