From 0eea8bb4ace4761f95b5728f74b3b27c847e64b6 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Fri, 15 Nov 2024 16:26:18 +0530 Subject: [PATCH] delete_topic: Add support for empty topic name. --- zerver/openapi/zulip.yaml | 7 +++++++ zerver/views/streams.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index dac8bf6f55..621e2a719d 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -20451,6 +20451,13 @@ paths: topic_name: description: | The name of the topic to delete. + + Note: When the value of `realm_empty_topic_display_name` found in + the [POST /register](/api/register-queue) response is used for this + parameter, it is interpreted as an empty string. + + **Changes**: Before Zulip 10.0 (feature level 334), empty string + was not a valid topic name for channel messages. type: string example: new coffee machine required: diff --git a/zerver/views/streams.py b/zerver/views/streams.py index e095db020c..feeea02dae 100644 --- a/zerver/views/streams.py +++ b/zerver/views/streams.py @@ -80,6 +80,7 @@ from zerver.lib.subscription_info import gather_subscriptions from zerver.lib.topic import ( get_topic_history_for_public_stream, get_topic_history_for_stream, + maybe_rename_general_chat_to_empty_topic, messages_for_topic, ) from zerver.lib.typed_endpoint import ApiParamConfig, PathOnly, typed_endpoint @@ -965,6 +966,7 @@ def delete_in_topic( topic_name: str, ) -> HttpResponse: stream, ignored_sub = access_stream_by_id(user_profile, stream_id) + topic_name = maybe_rename_general_chat_to_empty_topic(topic_name) messages = messages_for_topic( user_profile.realm_id, assert_is_not_none(stream.recipient_id), topic_name