Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
notifications: Add safeties to prevent incorrect notifications.
Alex Vandiver094f22e6b4bd
diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.pyindex 8ace62680f7..c06f4b11d4e 100644--- a/zerver/lib/email_notifications.py+++ b/zerver/lib/email_notifications.py@@ -569,6 +569,10 @@ def handle_missedmessage_emails(# Never email bot users.return+ if not user_profile.enable_offline_email_notifications:+ # BUG: Investigate why it's possible to get here.+ return # nocoverage+# Note: This query structure automatically filters out any# messages that were permanently deleted, since those would now be# in the ArchivedMessage table, not the Message table.diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex 3df81400ea7..20e9961eda8 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -896,6 +896,17 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Anyreturnuser_profile = get_user_profile_by_id(user_profile_id)+ if user_profile.is_bot:+ # BUG: Investigate why it's possible to get here.+ return # nocoverage++ if not (+ user_profile.enable_offline_push_notifications+ or user_profile.enable_online_push_notifications+ ):+ # BUG: Investigate why it's possible to get here.+ return # nocoverage+try:(message, user_message) = access_message(user_profile, missed_message["message_id"])except JsonableError: