mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
settings: Add a new topics_policy realm setting.
Added a new realm setting, `topics_policy` and deprecated `mandatory_topics` setting as it now replaced by `topics_policy`. Fixes part of #33549.
This commit is contained in:
@@ -90,6 +90,7 @@ from zerver.models import (
|
||||
UserProfile,
|
||||
UserTopic,
|
||||
)
|
||||
from zerver.models.realms import RealmTopicsPolicyEnum
|
||||
from zerver.models.streams import get_stream_by_id_in_realm
|
||||
from zerver.models.users import ResolvedTopicNoticeAutoReadPolicyEnum, get_system_bot
|
||||
from zerver.tornado.django_api import send_event_on_commit
|
||||
@@ -128,7 +129,10 @@ def validate_message_edit_payload(
|
||||
if propagate_mode != "change_one" and topic_name is None and stream_id is None:
|
||||
raise JsonableError(_("Invalid propagate_mode without topic edit"))
|
||||
|
||||
if message.realm.mandatory_topics and topic_name in ("(no topic)", ""):
|
||||
if (
|
||||
message.realm.topics_policy == RealmTopicsPolicyEnum.disable_empty_topic.value
|
||||
and topic_name in ("(no topic)", "")
|
||||
):
|
||||
raise JsonableError(_("Topics are required in this organization."))
|
||||
|
||||
if topic_name in {
|
||||
|
||||
Reference in New Issue
Block a user