fix: validate thread replies reference the root event
Some relays ignore the eTags filter and return unrelated events in response to thread-replies subscriptions, causing random posts to appear as replies when viewing a thread. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
034c434445
commit
9ff5115c37
@@ -128,6 +128,13 @@ class ThreadViewModel : ViewModel() {
|
||||
eventRepo.addEventRelay(event.id, relayUrl)
|
||||
|
||||
if (Nip10.isStandaloneQuote(event)) return@collect
|
||||
|
||||
// Validate: event must reference the thread root (some relays ignore eTags filter)
|
||||
if (event.id != rootId &&
|
||||
event.tags.none { it.size >= 2 && it[0] == "e" && it[1] == rootId }) {
|
||||
return@collect
|
||||
}
|
||||
|
||||
val isNew = event.id !in threadEvents
|
||||
threadEvents[event.id] = event
|
||||
if (event.id == rootId) {
|
||||
|
||||
Reference in New Issue
Block a user