Skip to content

Commit

Permalink
filter.MatchesTags() helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Sep 30, 2024
1 parent d29025e commit 4d53087
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ func (ef Filter) MatchesIgnoringTimestampConstraints(event *Event) bool {
return false
}

return ef.MatchesTags(event)
}

func (ef Filter) MatchesTags(event *Event) bool {
for f, v := range ef.Tags {
if v != nil && !event.Tags.ContainsAny(f, v) {
return false
}
}

return true
}

Expand Down
3 changes: 1 addition & 2 deletions tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package nostr
import (
"encoding/json"
"errors"
"strings"

"slices"
"strings"
)

type Tag []string
Expand Down

0 comments on commit 4d53087

Please sign in to comment.