Compare commits

..

2 Commits

Author SHA1 Message Date
fiatjaf
89f11e214d fix filter matching for tags. 2022-01-02 19:46:19 -03:00
fiatjaf
bb09e25512 fix tag in matchFilter for kinds and ids. 2022-01-01 21:18:37 -03:00
2 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
export function matchFilter(filter, event) { export function matchFilter(filter, event) {
if (filter.ids && filter.ids.indexOf(event.id) !== -1) return false if (filter.ids && filter.ids.indexOf(event.id) === -1) return false
if (filter.kinds && filter.kinds.indexOf(event.kind) !== -1) return false if (filter.kinds && filter.kinds.indexOf(event.kind) === -1) return false
if (filter.authors && filter.authors.indexOf(event.pubkey) === -1) if (filter.authors && filter.authors.indexOf(event.pubkey) === -1)
return false return false
@@ -8,7 +8,9 @@ export function matchFilter(filter, event) {
if (f[0] === '#') { if (f[0] === '#') {
if ( if (
filter[f] && filter[f] &&
!event.tags.find(([t, v]) => t === f.slice(1) && v === filter[f]) !event.tags.find(
([t, v]) => t === f.slice(1) && filter[f].indexOf(v) !== -1
)
) )
return false return false
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "nostr-tools", "name": "nostr-tools",
"version": "0.16.0", "version": "0.16.2",
"description": "Tools for making a Nostr client.", "description": "Tools for making a Nostr client.",
"repository": { "repository": {
"type": "git", "type": "git",