push_notifications: Include stream_id in the notification data.

Closes #18067.
Previous only the stream name was sent, which is an unstable stream
identifier.
This commit is contained in:
Mateusz Mandera 2022-01-29 22:59:06 +01:00 committed by Tim Abbott
parent 487e7ccd11
commit c0f7158378
4 changed files with 15 additions and 1 deletions

View File

@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 5.0
**Feature level 115**
* Mobile push notifications about stream messages now include the
`stream_id` field.
**Feature level 114**
* [`GET /events`](/api/get-events): Added `rendering_only` field to

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 114
API_FEATURE_LEVEL = 115
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump

View File

@ -714,6 +714,7 @@ def get_message_payload(
if message.recipient.type == Recipient.STREAM:
data["recipient_type"] = "stream"
data["stream"] = get_display_recipient(message.recipient)
data["stream_id"] = message.recipient.type_id
data["topic"] = message.topic_name()
elif message.recipient.type == Recipient.HUDDLE:
data["recipient_type"] = "private"

View File

@ -1717,6 +1717,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"sender_email": self.sender.email,
"sender_id": self.sender.id,
"stream": get_display_recipient(message.recipient),
"stream_id": stream.id,
"topic": message.topic_name(),
"server": settings.EXTERNAL_HOST,
"realm_id": self.sender.realm.id,
@ -1747,6 +1748,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"sender_email": self.sender.email,
"sender_id": self.sender.id,
"stream": get_display_recipient(message.recipient),
"stream_id": stream.id,
"topic": message.topic_name(),
"server": settings.EXTERNAL_HOST,
"realm_id": self.sender.realm.id,
@ -1780,6 +1782,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"sender_email": self.sender.email,
"sender_id": self.sender.id,
"stream": get_display_recipient(message.recipient),
"stream_id": stream.id,
"topic": message.topic_name(),
"server": settings.EXTERNAL_HOST,
"realm_id": self.sender.realm.id,
@ -1814,6 +1817,7 @@ class TestGetAPNsPayload(PushNotificationTest):
"sender_email": self.sender.email,
"sender_id": self.sender.id,
"stream": get_display_recipient(message.recipient),
"stream_id": stream.id,
"topic": message.topic_name(),
"server": settings.EXTERNAL_HOST,
"realm_id": self.sender.realm.id,
@ -1901,6 +1905,7 @@ class TestGetGCMPayload(PushNotificationTest):
"sender_avatar_url": absolute_avatar_url(message.sender),
"recipient_type": "stream",
"stream": get_display_recipient(message.recipient),
"stream_id": stream.id,
"topic": message.topic_name(),
}
@ -1995,6 +2000,7 @@ class TestGetGCMPayload(PushNotificationTest):
"recipient_type": "stream",
"topic": "Test topic",
"stream": "Denmark",
"stream_id": stream.id,
},
)
self.assertDictEqual(
@ -2032,6 +2038,7 @@ class TestGetGCMPayload(PushNotificationTest):
"recipient_type": "stream",
"topic": "Test topic",
"stream": "Denmark",
"stream_id": stream.id,
},
)
self.assertDictEqual(