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.

settings: Add ZULIP_SERVICE_ADVERTISE_REALMS.

Prakhar Pratyush6327e15fb3b2
diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py
index bae1809ad99..6a21402cdc7 100644
--- a/zilencer/management/commands/populate_db.py
+++ b/zilencer/management/commands/populate_db.py
@@ -96,6 +96,7 @@ from zilencer.views import update_remote_realm_data_for_server
settings.ZULIP_SERVICE_PUSH_NOTIFICATIONS = False
settings.ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS = False
settings.ZULIP_SERVICE_SECURITY_ALERTS = False
+settings.ZULIP_SERVICE_ADVERTISE_REALMS = False
settings.ANALYTICS_DATA_UPLOAD_LEVEL = AnalyticsDataUploadLevel.NONE
settings.USING_TORNADO = False
# Disable using memcached caches to avoid 'unsupported pickle
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index a006c79061e..a805944893a 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -71,6 +71,7 @@ from .configured_settings import (
USING_CAPTCHA,
USING_PGROONGA,
ZULIP_ADMINISTRATOR,
+ ZULIP_SERVICE_ADVERTISE_REALMS,
ZULIP_SERVICE_PUSH_NOTIFICATIONS,
ZULIP_SERVICE_SECURITY_ALERTS,
ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS,
@@ -108,6 +109,7 @@ if raw_keys is not None:
service_name_to_required_upload_level = {
+ "advertise_realms": AnalyticsDataUploadLevel.BASIC,
"security_alerts": AnalyticsDataUploadLevel.BASIC,
"mobile_push": AnalyticsDataUploadLevel.BILLING,
"submit_usage_statistics": AnalyticsDataUploadLevel.ALL,
@@ -135,6 +137,8 @@ if ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS:
services_append("submit_usage_statistics")
if ZULIP_SERVICE_SECURITY_ALERTS:
services_append("security_alerts")
+if ZULIP_SERVICE_ADVERTISE_REALMS:
+ services_append("advertise_realms")
if services is None and PUSH_NOTIFICATION_BOUNCER_URL is not None:
# ZULIP_SERVICE_* are the new settings that control the services
@@ -156,7 +160,7 @@ if services is None and PUSH_NOTIFICATION_BOUNCER_URL is not None:
services_append("submit_usage_statistics")
if services is not None and set(services).intersection(
- {"submit_usage_statistics", "security_alerts", "mobile_push"}
+ {"submit_usage_statistics", "security_alerts", "mobile_push", "advertise_realms"}
):
# None of these make sense enabled without ZULIP_SERVICES_URL.
assert ZULIP_SERVICES_URL is not None, (
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 65e399d94fe..66b903cf8b3 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -269,6 +269,7 @@ ZULIP_SERVICE_PUSH_NOTIFICATIONS = False
# is enabled.
ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS: bool | None = None
ZULIP_SERVICE_SECURITY_ALERTS = False
+ZULIP_SERVICE_ADVERTISE_REALMS = False
# Old setting kept around for backwards compatibility. Some old servers
# may have it in their settings.py.
diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py
index 44e23ad6d38..83fd27c7584 100644
--- a/zproject/test_extra_settings.py
+++ b/zproject/test_extra_settings.py
@@ -228,6 +228,7 @@ ZULIP_SERVICES_URL = f"http://push.{EXTERNAL_HOST}"
ZULIP_SERVICE_PUSH_NOTIFICATIONS = False
ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS = False
ZULIP_SERVICE_SECURITY_ALERTS = False
+ZULIP_SERVICE_ADVERTISE_REALMS = False
# Hack: This should be computed in computed_settings, but the transmission
# of test settings overrides is wonky. See test_settings for more details.