mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-27 12:12:28 +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 {
|
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 a new issue