aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
Diffstat (limited to 'cache')
-rw-r--r--cache/filter.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cache/filter.go b/cache/filter.go
index 2ac56ab5..c167fe71 100644
--- a/cache/filter.go
+++ b/cache/filter.go
@@ -38,6 +38,16 @@ func AuthorFilter(query string) Filter {
}
}
+// MetadataFilter return a Filter that match a bug metadata at creation time
+func MetadataFilter(pair query.StringPair) Filter {
+ return func(excerpt *BugExcerpt, resolver resolver) bool {
+ if value, ok := excerpt.CreateMetadata[pair.Key]; ok {
+ return value == pair.Value
+ }
+ return false
+ }
+}
+
// LabelFilter return a Filter that match a label
func LabelFilter(label string) Filter {
return func(excerpt *BugExcerpt, resolver resolver) bool {
@@ -109,6 +119,7 @@ func NoLabelFilter() Filter {
type Matcher struct {
Status []Filter
Author []Filter
+ Metadata []Filter
Actor []Filter
Participant []Filter
Label []Filter
@@ -127,6 +138,9 @@ func compileMatcher(filters query.Filters) *Matcher {
for _, value := range filters.Author {
result.Author = append(result.Author, AuthorFilter(value))
}
+ for _, value := range filters.Metadata {
+ result.Metadata = append(result.Metadata, MetadataFilter(value))
+ }
for _, value := range filters.Actor {
result.Actor = append(result.Actor, ActorFilter(value))
}
@@ -153,6 +167,10 @@ func (f *Matcher) Match(excerpt *BugExcerpt, resolver resolver) bool {
return false
}
+ if match := f.orMatch(f.Metadata, excerpt, resolver); !match {
+ return false
+ }
+
if match := f.orMatch(f.Participant, excerpt, resolver); !match {
return false
}