Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

delete_topic: Add support for empty topic name.

Prakhar Pratyush0eea8bb4ace4
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index dac8bf6f55e..621e2a719d4 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 e095db020c9..feeea02dae2 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