From 3b72da8a7ce91ea660b79c70d23aeff83f555d07 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Tue, 14 Dec 2021 18:14:10 +0100 Subject: [PATCH] api: Include `stream_id` field for all edits to stream messages. Updates the `update_message` event type to always include a `stream_id` field when the message being edited is a stream message. This change aligns with the current definition of the `\get-events` endpoint in the OpenAPI documentation. --- templates/zerver/api/changelog.md | 5 +++++ version.py | 2 +- zerver/lib/actions.py | 2 +- zerver/openapi/zulip.yaml | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md index d42a13d8c6..f82904a642 100644 --- a/templates/zerver/api/changelog.md +++ b/templates/zerver/api/changelog.md @@ -20,6 +20,11 @@ format used by the Zulip server that they are interacting with. ## Changes in Zulip 5.0 +**Feature level 112** + +* [`GET /events`](/api/get-events): Updated `update_message` event type + to include `stream_id` field for all edits to stream messages. + **Feature level 111** * [`POST /subscriptions/properties`](/api/update-subscription-settings): diff --git a/version.py b/version.py index e6ccd36425..ece79ef083 100644 --- a/version.py +++ b/version.py @@ -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 = 111 +API_FEATURE_LEVEL = 112 # 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 diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 9c15c34a24..23be7898ce 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -6287,6 +6287,7 @@ def do_update_message( stream_id = target_message.recipient.type_id stream_being_edited = get_stream_by_id_in_realm(stream_id, realm) event["stream_name"] = stream_being_edited.name + event["stream_id"] = stream_being_edited.id ums = UserMessage.objects.filter(message=target_message.id) @@ -6380,7 +6381,6 @@ def do_update_message( if topic_name is not None or new_stream is not None: orig_topic_name = target_message.topic_name() event["propagate_mode"] = propagate_mode - event["stream_id"] = target_message.recipient.type_id if new_stream is not None: assert content is None diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index bc06c4760a..e4e1b27288 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -2030,6 +2030,11 @@ paths: The pre-edit stream for all of the messages with IDs in `message_ids`. + + **Changes**: As of Zulip 5.0 (feature level 112), this field + is present for all edits to a stream message. Previously, it + was not present when only the content of the stream message was + edited. new_stream_id: type: integer description: |