Re-apply filter when fetching events

This commit is contained in:
Jonathan Staab 2023-07-11 13:15:52 -07:00
parent 44365bf823
commit 6d0c7c796f
2 changed files with 5 additions and 9 deletions

View File

@ -1,18 +1,12 @@
# Current
- Cmd -> EventBuilder
- Create new "command" module that wraps event builder + outbox + any local anonymous state
- Move getUserRelays, getUserMutes etc back to user module?
- [ ] Refactor
- [ ] Move system initialization to app/system
- [ ] Delete messages when leaving a room
- [ ] Add pagination to chat/dms
- [ ] Fix scrolling to to when modal is open
- [ ] Take connection health into account when building hints
- [ ] Re-apply filter to get rid of unwanted events
- [ ] Test migration
- [ ] Improve watchers so users of system don't need to know how they work
- [ ] Remove external dependencies
- [ ] Check for TODOs
- [ ] Add custom emoji support
- [ ] Re-work note media

View File

@ -1,7 +1,7 @@
import type {Filter} from "nostr-tools"
import type {MyEvent} from "src/util/types"
import {EventEmitter} from "events"
import {verifySignature} from "nostr-tools"
import {verifySignature, matchFilters} from "nostr-tools"
import {Pool, Plex, Relays, Executor, Socket} from "paravel"
import {ensurePlural} from "hurdak/lib/hurdak"
import {union, difference} from "src/util/misc"
@ -212,7 +212,9 @@ export class Network extends EventEmitter {
return
}
// TODO: validate that the event we asked for matches the filters we sent
if (!matchFilters(filters, event)) {
return
}
this.emit("event", {url, event})