fetch_messages: Add support for empty topic names.

This commit is a part of the work to support empty string
as a topic name.

Previously, empty string was not a valid topic name.

Adds `allow_empty_topic_name` boolean parameter to `GET /messages`
and `GET /messages/{message_id}` endpoints to decide whether the
topic names in the fetched messages can be empty strings.

If False, the topic names in the fetched message will have the
value of `realm_empty_topic_display_name` field in `POST /register`
response replacing "" for channel messages.
This commit is contained in:
Prakhar Pratyush
2024-11-12 21:41:49 +05:30
committed by Tim Abbott
parent 3ba198e79a
commit 5d9beb3655
17 changed files with 229 additions and 13 deletions

View File

@@ -248,6 +248,11 @@ python_rules = RuleList(
"exclude_line": {
("zerver/lib/message.py", "message__subject__iexact=message.topic_name(),"),
("zerver/views/streams.py", "message__subject__iexact=topic_name,"),
("zerver/lib/message_cache.py", 'and obj["subject"] == ""'),
(
"zerver/lib/message_cache.py",
'obj["subject"] = Message.EMPTY_TOPIC_FALLBACK_NAME',
),
},
"include_only": {
"zerver/data_import/",