From ba97611a8b6a3126688425ff50bfaf35ea34cb77 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 4 Oct 2023 19:55:58 +0000 Subject: [PATCH] zilencer: Handle very old server push notifications. Tweaked by tabbott to add a comment about deprecation policies. --- zilencer/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zilencer/views.py b/zilencer/views.py index cd734051ce..372eb9cbcf 100644 --- a/zilencer/views.py +++ b/zilencer/views.py @@ -319,7 +319,11 @@ def remote_server_notify_push( remote_queue_latency: Optional[str] = None sent_time: Optional[Union[float, int]] = gcm_payload.get( - "time", apns_payload["custom"]["zulip"].get("time") + # TODO/compatibility: This could be a lot simpler if not for pre-5.0 Zulip servers + # that had an older format. Future implementation: + # "time", apns_payload["custom"]["zulip"].get("time") + "time", + apns_payload.get("custom", {}).get("zulip", {}).get("time"), ) if sent_time is not None: if isinstance(sent_time, int):