fix previous commit plugins.

This commit is contained in:
fiatjaf 2023-11-07 16:35:27 -03:00
parent b277dae743
commit 487b84cf2d
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

@ -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)
}
}