mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
notifications: Add safeties to prevent incorrect notifications.
de04f0ad67changed now notifications recipients were calculated, in a manner that caused them to be sent when they should not have been.ac70a2d2e1was supposed to resolve this, but appears to have been insufficient, as all three of these cases have been observed to still happen. Add safety checks immediately before notification, until the underlying logic error can be sussed out.
This commit is contained in:
committed by
Tim Abbott
parent
5b45f8a128
commit
094f22e6b4
@@ -896,6 +896,17 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Any
|
||||
return
|
||||
user_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:
|
||||
|
||||
Reference in New Issue
Block a user