From ffabebd7f36b3d12ec864584eb6f159ae82d24b5 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 7 Feb 2019 17:16:42 -0800 Subject: [PATCH] push notif: Set GCM priority `high` for real notifications. This is the payoff of this branch! Fixes zulip/zulip-mobile#3185. --- zerver/lib/push_notifications.py | 2 +- zerver/tests/test_push_notifications.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py index 9eb9fd8795..1b52698a1d 100644 --- a/zerver/lib/push_notifications.py +++ b/zerver/lib/push_notifications.py @@ -667,7 +667,7 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Any apns_payload = get_apns_payload(user_profile, message) gcm_payload = get_gcm_payload(user_profile, message) - gcm_options = {} # type: Dict[str, Any] + gcm_options = {'priority': 'high'} # type: Dict[str, Any] logger.info("Sending push notifications to mobile clients for user %s" % (user_profile_id,)) if uses_notification_bouncer(): diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 6757804967..84681235a8 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -646,7 +646,7 @@ class HandlePushNotificationTest(PushNotificationTest): mock_send.assert_called_with(user_profile.id, {'apns': True}, {'gcm': True}, - {}, + {'priority': 'high'}, ) def test_non_bouncer_push(self) -> None: @@ -688,7 +688,7 @@ class HandlePushNotificationTest(PushNotificationTest): mock_send_apple.assert_called_with(self.user_profile.id, apple_devices, {'apns': True}) - mock_send_android.assert_called_with(android_devices, {'gcm': True}, {}) + mock_send_android.assert_called_with(android_devices, {'gcm': True}, {'priority': 'high'}) mock_push_notifications.assert_called_once() @override_settings(SEND_REMOVE_PUSH_NOTIFICATIONS=True) @@ -799,7 +799,7 @@ class HandlePushNotificationTest(PushNotificationTest): mock_send_apple.assert_called_with(self.user_profile.id, apple_devices, {'apns': True}) - mock_send_android.assert_called_with(android_devices, {'gcm': True}, {}) + mock_send_android.assert_called_with(android_devices, {'gcm': True}, {'priority': 'high'}) mock_push_notifications.assert_called_once() class TestAPNs(PushNotificationTest):