From 487b84cf2de0a76018cf01b7df3a4c4391719d59 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 7 Nov 2023 16:35:27 -0300 Subject: [PATCH] fix previous commit plugins. --- plugins/filters.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/filters.go b/plugins/filters.go index 676c022..df81280 100644 --- a/plugins/filters.go +++ b/plugins/filters.go @@ -39,12 +39,12 @@ func RemoveSearchQueries(ctx context.Context, filter *nostr.Filter) { filter.Search = "" } -func RemoveKinds(kinds ...int) func(context.Context, *nostr.Filter) { +func RemoveAllButKinds(kinds ...uint16) func(context.Context, *nostr.Filter) { return func(ctx context.Context, filter *nostr.Filter) { if n := len(filter.Kinds); n > 0 { newKinds := make([]int, 0, n) for i := 0; i < n; i++ { - if k := filter.Kinds[i]; !slices.Contains(kinds, k) { + if k := filter.Kinds[i]; slices.Contains(kinds, uint16(k)) { newKinds = append(newKinds, k) } } @@ -53,10 +53,10 @@ func RemoveKinds(kinds ...int) func(context.Context, *nostr.Filter) { } } -func RemoveTags(tagNames ...string) func(context.Context, *nostr.Filter) { +func RemoveAllButTags(tagNames ...string) func(context.Context, *nostr.Filter) { return func(ctx context.Context, filter *nostr.Filter) { for tagName := range filter.Tags { - if slices.Contains(tagNames, tagName) { + if !slices.Contains(tagNames, tagName) { delete(filter.Tags, tagName) } }