Query filters only apply to message events

pull/60/head
Philipp Heckel 2021-12-21 21:29:37 +01:00
parent 9315829bc4
commit 09bf13bd70
1 changed files with 3 additions and 4 deletions

View File

@ -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 {
if msg.Event != messageEvent {
return true // filters only apply to messages
}
if messageFilter != "" && msg.Message != messageFilter {
log.Printf("1")
return false
}
if titleFilter != "" && msg.Title != titleFilter {
log.Printf("2")
return false
}
if priorityFilter > 0 && (msg.Priority != priorityFilter || (msg.Priority == 0 && priorityFilter != 3)) {
log.Printf("3")
return false
}
if len(tagsFilter) > 0 && !util.InStringListAll(msg.Tags, tagsFilter) {
log.Printf("4")
return false
}
return true