mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 12:21:58 +00:00
message_edit: Cleanup empty topic check.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user