Skip to content

Commit 47a8945

Browse files
fix(notification): prevent push notifications in developer mode or local environments (The-Commit-Company#2097)
1 parent 4fe4a16 commit 47a8945

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

raven/notification.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ def send_notification_for_message(message):
1818
This is called in the "after_response" hook for user initiated requests.
1919
"""
2020

21+
# if in developer mode or frappe.utils.get_url() is a localhost URL, then we should not send the push notification
22+
# reason: avoid sending notifications from restored backups from local environments
23+
if (
24+
frappe.conf.developer_mode
25+
or frappe.utils.get_url().startswith("http://localhost")
26+
or frappe.utils.get_url().startswith("http://127.0.0.1")
27+
):
28+
return
29+
2130
raven_settings = frappe.get_cached_doc("Raven Settings")
2231

2332
if raven_settings.push_notification_service == "Raven":

0 commit comments

Comments
 (0)