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.

message_edit: Cleanup empty topic check.

Vector73d0bc9b8f9264
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py
index 18dd9903b75..1e490acfb60 100644
--- a/zerver/actions/message_edit.py
+++ b/zerver/actions/message_edit.py
@@ -1485,18 +1485,15 @@ def build_message_edit_request(
topics_policy = get_stream_topics_policy(message.realm, target_stream)
empty_topic_display_name = get_topic_display_name("", user_profile.default_language)
- target_topic_empty = ("(no topic)", "")
+ target_topic_empty = target_topic_name in ("(no topic)", "")
if (
- target_topic_name in target_topic_empty
+ target_topic_empty
and (is_topic_edited or is_stream_edited)
and topics_policy == StreamTopicsPolicyEnum.disable_empty_topic.value
):
raise MessagesNotAllowedInEmptyTopicError(empty_topic_display_name)
- if (
- topics_policy == StreamTopicsPolicyEnum.empty_topic_only.value
- and target_topic_name not in target_topic_empty
- ):
+ if topics_policy == StreamTopicsPolicyEnum.empty_topic_only.value and not target_topic_empty:
raise TopicsNotAllowedError(empty_topic_display_name)
return StreamMessageEditRequest(