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.

mark_topic_as_read: Add support for empty topic name.

Prakhar Pratyush1a83c23c8358
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 25c21219b35..87caf1eb1ae 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -5689,6 +5689,13 @@ paths:
topic_name:
description: |
The name of the topic whose messages should be marked as read.
+
+ 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/message_flags.py b/zerver/views/message_flags.py
index 04f2779352e..3777e06e4c5 100644
--- a/zerver/views/message_flags.py
+++ b/zerver/views/message_flags.py
@@ -14,7 +14,7 @@ from zerver.lib.narrow import NarrowParameter, fetch_messages, parse_anchor_valu
from zerver.lib.request import RequestNotes
from zerver.lib.response import json_success
from zerver.lib.streams import access_stream_by_id
-from zerver.lib.topic import user_message_exists_for_topic
+from zerver.lib.topic import maybe_rename_general_chat_to_empty_topic, user_message_exists_for_topic
from zerver.lib.typed_endpoint import (
ApiParamConfig,
typed_endpoint,
@@ -160,6 +160,7 @@ def mark_topic_as_read(
assert stream.recipient_id is not None
if topic_name:
+ topic_name = maybe_rename_general_chat_to_empty_topic(topic_name)
topic_exists = user_message_exists_for_topic(
user_profile=user_profile,
recipient_id=stream.recipient_id,