From dd134ef32504bb0eff73eb0a7cca1dd3ee8501fb Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Mon, 4 Aug 2025 11:32:31 +0530 Subject: [PATCH] push_notification: Remove 'content_truncated' field from FCM payload. This commit removes the 'content_truncated' field from the FCM payload to send push notification as it was unused by clients. --- api_docs/changelog.md | 2 ++ zerver/lib/push_notifications.py | 3 +-- zerver/tests/test_push_notifications.py | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/api_docs/changelog.md b/api_docs/changelog.md index 0c9c7caf91..ed78b5c0c1 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -28,6 +28,8 @@ format used by the Zulip server that they are interacting with. notifications no longer contain the legacy pre-2019 `zulip_message_id` field; all functional clients support the newer `zulip_message_ids`. +* Mobile push notification payloads for FCM to for new messages no + longer contain the (unused) `content_truncated` boolean field. **Feature level 412** diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py index dea1474c16..a9284cc893 100644 --- a/zerver/lib/push_notifications.py +++ b/zerver/lib/push_notifications.py @@ -1180,13 +1180,12 @@ def get_message_payload_gcm( assert message.rendered_content is not None with override_language(user_profile.default_language): - content, truncated = truncate_content(get_mobile_push_content(message.rendered_content)) + content, unused = truncate_content(get_mobile_push_content(message.rendered_content)) data.update( event="message", zulip_message_id=message.id, # message_id is reserved for CCS time=datetime_to_timestamp(message.date_sent), content=content, - content_truncated=truncated, sender_full_name=sender_name, sender_avatar_url=sender_avatar_url, ) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 8c24da0975..ba6f3c4d60 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -784,7 +784,6 @@ class PushBouncerNotificationTest(BouncerTestCase): "zulip_message_id": message.id, "time": datetime_to_timestamp(message.date_sent), "content": message.content, - "content_truncated": False, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_uri": hamlet.realm.url, @@ -1816,7 +1815,6 @@ class TestGetGCMPayload(PushNotificationTestCase): "zulip_message_id": message.id, "time": datetime_to_timestamp(message.date_sent), "content": content, - "content_truncated": truncate_content, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, @@ -1879,7 +1877,6 @@ class TestGetGCMPayload(PushNotificationTestCase): "zulip_message_id": message.id, "time": datetime_to_timestamp(message.date_sent), "content": message.content, - "content_truncated": False, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name, @@ -1927,7 +1924,6 @@ class TestGetGCMPayload(PushNotificationTestCase): "zulip_message_id": message.id, "time": datetime_to_timestamp(message.date_sent), "content": message.content, - "content_truncated": False, "server": settings.EXTERNAL_HOST, "realm_id": hamlet.realm.id, "realm_name": hamlet.realm.name,