Allow disabling notifications
This commit is contained in:
parent
c356f58d8a
commit
2a034a16e7
|
@ -95,6 +95,9 @@ def sendmsg(**kwargs):
|
||||||
return
|
return
|
||||||
|
|
||||||
service = notification_settings.get("service")
|
service = notification_settings.get("service")
|
||||||
|
if service == "none":
|
||||||
|
# Don't send anything
|
||||||
|
return
|
||||||
|
|
||||||
if service == "ntfy":
|
if service == "ntfy":
|
||||||
ntfy_sendmsg(**kwargs)
|
ntfy_sendmsg(**kwargs)
|
||||||
|
|
|
@ -140,6 +140,9 @@ def rule_notify(rule, index, message, meta=None):
|
||||||
if not notification_settings:
|
if not notification_settings:
|
||||||
# No/invalid notification settings, don't send anything
|
# No/invalid notification settings, don't send anything
|
||||||
return
|
return
|
||||||
|
if notification_settings.get("service") == "none":
|
||||||
|
# Don't send anything
|
||||||
|
return
|
||||||
|
|
||||||
# Create a cast we can reuse for the formatting helpers and sendmsg
|
# Create a cast we can reuse for the formatting helpers and sendmsg
|
||||||
cast = {
|
cast = {
|
||||||
|
|
|
@ -39,6 +39,7 @@ INTERVAL_CHOICES = (
|
||||||
SERVICE_CHOICES = (
|
SERVICE_CHOICES = (
|
||||||
("ntfy", "NTFY"),
|
("ntfy", "NTFY"),
|
||||||
("webhook", "Custom webhook"),
|
("webhook", "Custom webhook"),
|
||||||
|
("none", "Disabled"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue