stream_settings: Add new disable_topics option to topics_policy.

Adds new configuration option `disable_topics` in `topics_policy`
channel setting to support disabling topics in the channel.

Fixes #34553.
This commit is contained in:
Vector73
2025-07-08 04:46:33 +00:00
committed by Tim Abbott
parent 7b60b2edca
commit a77fc6aa79
38 changed files with 472 additions and 38 deletions

View File

@@ -264,9 +264,19 @@ def get_user_ids_with_metadata_access_via_permission_groups(stream: Stream) -> s
def channel_events_topic_name(stream: Stream) -> str:
if stream.topics_policy == StreamTopicsPolicyEnum.empty_topic_only.value:
return ""
return str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME)
def channel_has_named_topics(stream: Stream) -> bool:
return (
Message.objects.filter(realm_id=stream.realm_id, recipient=stream.recipient)
.exclude(subject="")
.exists()
)
@transaction.atomic(savepoint=False)
def create_stream_if_needed(
realm: Realm,