Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
push_notifications: Provide subsecond granularity on the sent time.
Alex Vandiverb8581e2895e2
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex 68853a0d004..180311ed60c 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -38,7 +38,6 @@ from zerver.lib.message import access_message, huddle_usersfrom zerver.lib.outgoing_http import OutgoingSessionfrom zerver.lib.remote_server import send_json_to_push_bouncer, send_to_push_bouncerfrom zerver.lib.soft_deactivation import soft_reactivate_if_personal_notification-from zerver.lib.timestamp import datetime_to_timestampfrom zerver.models import (AbstractPushDeviceToken,ArchivedMessage,@@ -942,7 +941,7 @@ def get_message_payload_gcm(data.update(event="message",zulip_message_id=message.id, # message_id is reserved for CCS- time=datetime_to_timestamp(message.date_sent),+ time=message.date_sent.timestamp(),content=content,content_truncated=truncated,sender_full_name=message.sender.full_name,diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex f63ac482862..fbec6415f24 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -60,7 +60,6 @@ from zerver.lib.remote_server import (from zerver.lib.response import json_response_from_errorfrom zerver.lib.test_classes import ZulipTestCasefrom zerver.lib.test_helpers import mock_queue_publish-from zerver.lib.timestamp import datetime_to_timestampfrom zerver.lib.user_counts import realm_user_count_by_rolefrom zerver.models import (Message,@@ -2255,7 +2254,7 @@ class TestGetGCMPayload(PushNotificationTest):"user_id": hamlet.id,"event": "message","zulip_message_id": message.id,- "time": datetime_to_timestamp(message.date_sent),+ "time": message.date_sent.timestamp(),"content": content,"content_truncated": truncate_content,"server": settings.EXTERNAL_HOST,@@ -2313,7 +2312,7 @@ class TestGetGCMPayload(PushNotificationTest):"user_id": hamlet.id,"event": "message","zulip_message_id": message.id,- "time": datetime_to_timestamp(message.date_sent),+ "time": message.date_sent.timestamp(),"content": message.content,"content_truncated": False,"server": settings.EXTERNAL_HOST,@@ -2345,7 +2344,7 @@ class TestGetGCMPayload(PushNotificationTest):"user_id": hamlet.id,"event": "message","zulip_message_id": message.id,- "time": datetime_to_timestamp(message.date_sent),+ "time": message.date_sent.timestamp(),"content": "*This organization has disabled including message content in mobile push notifications*","content_truncated": False,"server": settings.EXTERNAL_HOST,