Query filters only apply to message events
parent
9315829bc4
commit
09bf13bd70
|
@ -489,20 +489,19 @@ func parseQueryFilters(r *http.Request) (messageFilter string, titleFilter strin
|
||||||
}
|
}
|
||||||
|
|
||||||
func passesQueryFilter(msg *message, messageFilter string, titleFilter string, priorityFilter int, tagsFilter []string) bool {
|
func passesQueryFilter(msg *message, messageFilter string, titleFilter string, priorityFilter int, tagsFilter []string) bool {
|
||||||
|
if msg.Event != messageEvent {
|
||||||
|
return true // filters only apply to messages
|
||||||
|
}
|
||||||
if messageFilter != "" && msg.Message != messageFilter {
|
if messageFilter != "" && msg.Message != messageFilter {
|
||||||
log.Printf("1")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if titleFilter != "" && msg.Title != titleFilter {
|
if titleFilter != "" && msg.Title != titleFilter {
|
||||||
log.Printf("2")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if priorityFilter > 0 && (msg.Priority != priorityFilter || (msg.Priority == 0 && priorityFilter != 3)) {
|
if priorityFilter > 0 && (msg.Priority != priorityFilter || (msg.Priority == 0 && priorityFilter != 3)) {
|
||||||
log.Printf("3")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(tagsFilter) > 0 && !util.InStringListAll(msg.Tags, tagsFilter) {
|
if len(tagsFilter) > 0 && !util.InStringListAll(msg.Tags, tagsFilter) {
|
||||||
log.Printf("4")
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue