Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifs: Rename parse_gcm_options to parse_fcm_options.
Mateusz Mandera297141f8c472
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex 43af5a24b59..6a821e1e26e 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -402,7 +402,7 @@ def send_android_push_notification_to_user()-def parse_gcm_options(options: Dict[str, Any], data: Dict[str, Any]) -> str:+def parse_fcm_options(options: Dict[str, Any], data: Dict[str, Any]) -> str:"""Parse FCM options, supplying defaults, and raising an error if invalid.@@ -463,7 +463,7 @@ def send_android_push_notification(data: The JSON object (decoded) to send as the 'data' parameter ofthe FCM message.options: Additional options to control the FCM message sent.- For details, see `parse_gcm_options`.+ For details, see `parse_fcm_options`."""if not devices:return 0@@ -486,7 +486,7 @@ def send_android_push_notification("GCM: Sending notification for local user %s to %d devices", user_identity, len(devices))reg_ids = [device.token for device in devices]- priority = parse_gcm_options(options, data)+ priority = parse_fcm_options(options, data)try:# See https://firebase.google.com/docs/cloud-messaging/http-server-ref .# Two kwargs `retries` and `session` get eaten by `json_request`;diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex 4186a800933..1d647710a5c 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -59,7 +59,7 @@ from zerver.lib.push_notifications import (handle_remove_push_notification,hex_to_b64,modernize_apns_payload,- parse_gcm_options,+ parse_fcm_options,send_android_push_notification_to_user,send_apple_push_notification,send_notifications_to_bouncer,@@ -4773,20 +4773,20 @@ class TestPushApi(BouncerTestCase):class GCMParseOptionsTest(ZulipTestCase):def test_invalid_option(self) -> None:with self.assertRaises(JsonableError):- parse_gcm_options({"invalid": True}, {})+ parse_fcm_options({"invalid": True}, {})def test_invalid_priority_value(self) -> None:with self.assertRaises(JsonableError):- parse_gcm_options({"priority": "invalid"}, {})+ parse_fcm_options({"priority": "invalid"}, {})def test_default_priority(self) -> None:- self.assertEqual("high", parse_gcm_options({}, {"event": "message"}))- self.assertEqual("normal", parse_gcm_options({}, {"event": "remove"}))- self.assertEqual("normal", parse_gcm_options({}, {}))+ self.assertEqual("high", parse_fcm_options({}, {"event": "message"}))+ self.assertEqual("normal", parse_fcm_options({}, {"event": "remove"}))+ self.assertEqual("normal", parse_fcm_options({}, {}))def test_explicit_priority(self) -> None:- self.assertEqual("normal", parse_gcm_options({"priority": "normal"}, {}))- self.assertEqual("high", parse_gcm_options({"priority": "high"}, {}))+ self.assertEqual("normal", parse_fcm_options({"priority": "normal"}, {}))+ self.assertEqual("high", parse_fcm_options({"priority": "high"}, {}))@mock.patch("zerver.lib.push_notifications.gcm_client")