From 80e76d24e9b9c461f4e32cc12c9340967cc452a8 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Tue, 29 Apr 2025 11:35:02 +0530 Subject: [PATCH] create_realm: Show import text only if automated import is disabled. This helps preserve the original form in production. The new "Import from" option button allows user to automate the process, so this is not required in that case. --- templates/zerver/create_realm.html | 2 ++ zerver/context_processors.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/templates/zerver/create_realm.html b/templates/zerver/create_realm.html index 179aedb7f8..4975d60f5f 100644 --- a/templates/zerver/create_realm.html +++ b/templates/zerver/create_realm.html @@ -47,6 +47,7 @@ + {% if not is_realm_import_enabled %}
{% trans %} Or import @@ -54,6 +55,7 @@ or Rocket.Chat. {% endtrans %}
+ {% endif %} diff --git a/zerver/context_processors.py b/zerver/context_processors.py index fe430c8c4c..4377a02a8b 100644 --- a/zerver/context_processors.py +++ b/zerver/context_processors.py @@ -283,6 +283,10 @@ def latest_info_context() -> dict[str, str]: return context +def is_realm_import_enabled() -> bool: + return settings.MAX_WEB_DATA_IMPORT_SIZE_MB != 0 + + def get_realm_create_form_context() -> dict[str, Any]: context = { "language_list": get_language_list(), @@ -290,5 +294,6 @@ def get_realm_create_form_context() -> dict[str, Any]: "MAX_REALM_SUBDOMAIN_LENGTH": str(Realm.MAX_REALM_SUBDOMAIN_LENGTH), "root_domain_available": is_root_domain_available(), "sorted_realm_types": sorted(Realm.ORG_TYPES.values(), key=lambda d: d["display_order"]), + "is_realm_import_enabled": is_realm_import_enabled(), } return context