From 9c2d53bcef5b9fa101c78426f11d1db3b8c288f6 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 6 Nov 2023 13:02:06 -0800 Subject: [PATCH] push_notifs: Stop dropping ios_app_id on floor at bouncer. This missing `REQ` call has meant we just drop this parameter: even though the remote Zulip server passes it (for all APNs tokens), we never notice and never store it. Fix that. --- zerver/tests/test_push_notifications.py | 3 ++- zilencer/views.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 9f6a5a22f6..bb86081146 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -838,7 +838,8 @@ class PushBouncerNotificationTest(BouncerTestCase): ) ) self.assert_length(tokens, 1) - self.assertEqual(tokens[0].token, token) + self.assertEqual(tokens[0].kind, kind) + self.assertEqual(tokens[0].ios_app_id, appid.get("appid")) # User should have tokens for both devices now. tokens = list(RemotePushDeviceToken.objects.filter(user_uuid=user.uuid, server=server)) diff --git a/zilencer/views.py b/zilencer/views.py index 0fac09d712..971b48c85c 100644 --- a/zilencer/views.py +++ b/zilencer/views.py @@ -162,7 +162,7 @@ def register_remote_push_device( user_uuid: Optional[str] = REQ(default=None), token: str = REQ(), token_kind: int = REQ(json_validator=check_int), - ios_app_id: Optional[str] = None, + ios_app_id: Optional[str] = REQ(default=None), ) -> HttpResponse: validate_bouncer_token_request(token, token_kind)