mirror of
https://github.com/fiatjaf/khatru.git
synced 2025-03-19 14:22:11 +01:00
fix previous commit plugins.
This commit is contained in:
parent
b277dae743
commit
487b84cf2d
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user