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.

analytics: More fixes to zilencer urls import logic.

Tim Abbott95b39bc8bf3b
diff --git a/analytics/urls.py b/analytics/urls.py
index d5817e6afd2..d6975467ba0 100644
--- a/analytics/urls.py
+++ b/analytics/urls.py
@@ -18,10 +18,8 @@ from analytics.views.stats import (
stats,
stats_for_installation,
stats_for_realm,
- stats_for_remote_installation,
- stats_for_remote_realm,
)
-from analytics.views.support import remote_servers_support, support
+from analytics.views.support import support
from analytics.views.user_activity import get_user_activity
from zerver.lib.rest import rest_path
@@ -30,7 +28,6 @@ i18n_urlpatterns: List[Union[URLPattern, URLResolver]] = [
path("activity", get_installation_activity),
path("activity/integrations", get_integrations_activity),
path("activity/support", support, name="support"),
- path("activity/remote/support", remote_servers_support, name="remote_servers_support"),
path("realm_activity/<realm_str>/", get_realm_activity),
path("user_activity/<user_profile_id>/", get_user_activity),
path("stats/realm/<realm_str>/", stats_for_realm),
@@ -41,10 +38,8 @@ i18n_urlpatterns: List[Union[URLPattern, URLResolver]] = [
if settings.ZILENCER_ENABLED:
from analytics.views.remote_activity import get_remote_server_activity
- from analytics.views.stats import (
- get_chart_data_for_remote_installation,
- get_chart_data_for_remote_realm,
- )
+ from analytics.views.stats import stats_for_remote_installation, stats_for_remote_realm
+ from analytics.views.support import remote_servers_support
i18n_urlpatterns += [
path("activity/remote", get_remote_server_activity),
@@ -53,6 +48,7 @@ if settings.ZILENCER_ENABLED:
"stats/remote/<int:remote_server_id>/realm/<int:remote_realm_id>/",
stats_for_remote_realm,
),
+ path("activity/remote/support", remote_servers_support, name="remote_servers_support"),
]
# These endpoints are a part of the API (V1), which uses:
@@ -69,16 +65,25 @@ v1_api_and_json_patterns = [
rest_path("analytics/chart_data/stream/<stream_id>", GET=get_chart_data_for_stream),
rest_path("analytics/chart_data/realm/<realm_str>", GET=get_chart_data_for_realm),
rest_path("analytics/chart_data/installation", GET=get_chart_data_for_installation),
- rest_path(
- "analytics/chart_data/remote/<int:remote_server_id>/installation",
- GET=get_chart_data_for_remote_installation,
- ),
- rest_path(
- "analytics/chart_data/remote/<int:remote_server_id>/realm/<int:remote_realm_id>",
- GET=get_chart_data_for_remote_realm,
- ),
]
+if settings.ZILENCER_ENABLED:
+ from analytics.views.stats import (
+ get_chart_data_for_remote_installation,
+ get_chart_data_for_remote_realm,
+ )
+
+ v1_api_and_json_patterns += [
+ rest_path(
+ "analytics/chart_data/remote/<int:remote_server_id>/installation",
+ GET=get_chart_data_for_remote_installation,
+ ),
+ rest_path(
+ "analytics/chart_data/remote/<int:remote_server_id>/realm/<int:remote_realm_id>",
+ GET=get_chart_data_for_remote_realm,
+ ),
+ ]
+
i18n_urlpatterns += [
path("api/v1/", include(v1_api_and_json_patterns)),
path("json/", include(v1_api_and_json_patterns)),