mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-26 19:52:30 +01:00
Query filters only apply to message events
This commit is contained in:
parent
9315829bc4
commit
09bf13bd70
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue