From 8ab526a25a9ce16c3d672e160b7d4f4798c1b993 Mon Sep 17 00:00:00 2001 From: Vector73 Date: Mon, 6 May 2024 18:57:22 +0530 Subject: [PATCH] models: Replace realm.uri with realm.url. In #23380, we are changing all occurrences of uri with url in order to follow the latest URL standard. Previous PRs #25038 and #25045 has replaced the occurences of uri that has no direct relation with realm. This commit changes just the model property, which has no API compatibility concerns. --- confirmation/models.py | 2 +- corporate/lib/stripe.py | 6 ++-- corporate/lib/support.py | 4 +-- corporate/views/portico.py | 2 +- .../corporate/support/realm_details.html | 2 +- templates/zerver/development/dev_login.html | 12 ++++---- templates/zerver/emails/find_team.html | 2 +- templates/zerver/emails/find_team.txt | 2 +- templates/zerver/emails/password_reset.html | 2 +- templates/zerver/emails/password_reset.txt | 2 +- .../zerver/emails/realm_auto_downgraded.html | 2 +- .../zerver/emails/realm_auto_downgraded.txt | 2 +- tools/generate-integration-docs-screenshot | 6 ++-- zerver/actions/create_realm.py | 10 +++---- zerver/actions/realm_settings.py | 2 +- zerver/context_processors.py | 4 +-- zerver/forms.py | 4 +-- zerver/lib/avatar.py | 2 +- zerver/lib/email_notifications.py | 8 +++--- zerver/lib/events.py | 2 +- zerver/lib/markdown/__init__.py | 2 +- zerver/lib/onboarding.py | 10 +++---- zerver/lib/push_notifications.py | 2 +- zerver/lib/remote_server.py | 2 +- zerver/lib/scim.py | 4 +-- zerver/lib/send_email.py | 2 +- zerver/lib/upload/__init__.py | 2 +- zerver/lib/upload/local.py | 4 +-- zerver/lib/url_encoding.py | 12 ++++---- zerver/management/commands/list_realms.py | 4 +-- .../commands/send_password_reset_email.py | 2 +- zerver/middleware.py | 2 +- .../0373_fix_deleteduser_dummies.py | 2 +- .../0501_delete_dangling_usermessages.py | 2 +- zerver/models/realms.py | 2 +- zerver/openapi/test_curl_examples.py | 2 +- zerver/tests/test_auth_backends.py | 22 +++++++-------- zerver/tests/test_middleware.py | 2 +- zerver/tests/test_push_notifications.py | 28 +++++++++---------- zerver/tests/test_realm.py | 2 +- zerver/tests/test_realm_export.py | 2 +- zerver/tests/test_signup.py | 8 +++--- zerver/tests/test_subdomains.py | 6 ++-- zerver/views/auth.py | 20 ++++++------- zerver/views/development/dev_login.py | 8 +++--- zerver/views/realm.py | 2 +- zerver/views/registration.py | 4 +-- zerver/views/users.py | 2 +- zerver/views/video_calls.py | 2 +- .../commands/populate_billing_realms.py | 2 +- zproject/backends.py | 6 ++-- 51 files changed, 125 insertions(+), 125 deletions(-) diff --git a/confirmation/models.py b/confirmation/models.py index 42f67daabc..6740b30cb5 100644 --- a/confirmation/models.py +++ b/confirmation/models.py @@ -201,7 +201,7 @@ def confirmation_url( url_args = dict(url_args) url_args["confirmation_key"] = confirmation_key return urljoin( - settings.ROOT_DOMAIN_URI if realm is None else realm.uri, + settings.ROOT_DOMAIN_URI if realm is None else realm.url, reverse(_properties[confirmation_type].url_name, kwargs=url_args), ) diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py index 62cae5239d..c6590f9320 100644 --- a/corporate/lib/stripe.py +++ b/corporate/lib/stripe.py @@ -389,7 +389,7 @@ def payment_method_string(stripe_customer: stripe.Customer) -> str: def build_support_url(support_view: str, query_text: str) -> str: - support_realm_url = get_realm(settings.STAFF_SUBDOMAIN).uri + support_realm_url = get_realm(settings.STAFF_SUBDOMAIN).url support_url = urljoin(support_realm_url, reverse(support_view)) query = urlencode({"q": query_text}) support_url = append_url_query_string(support_url, query) @@ -3756,7 +3756,7 @@ class RealmBillingSession(BillingSession): @override @property def billing_session_url(self) -> str: - return self.realm.uri + return self.realm.url @override @property @@ -5310,7 +5310,7 @@ def downgrade_small_realms_behind_on_payments_as_needed() -> None: billing_session.downgrade_now_without_creating_additional_invoices() billing_session.void_all_open_invoices() context: Dict[str, Union[str, Realm]] = { - "upgrade_url": f"{realm.uri}{reverse('upgrade_page')}", + "upgrade_url": f"{realm.url}{reverse('upgrade_page')}", "realm": realm, } send_email_to_billing_admins_and_realm_owners( diff --git a/corporate/lib/support.py b/corporate/lib/support.py index 731188fa1c..2f08f552ad 100644 --- a/corporate/lib/support.py +++ b/corporate/lib/support.py @@ -112,9 +112,9 @@ class CloudSupportData: def get_realm_support_url(realm: Realm) -> str: - support_realm_uri = get_realm(settings.STAFF_SUBDOMAIN).uri + support_realm_url = get_realm(settings.STAFF_SUBDOMAIN).url support_url = urljoin( - support_realm_uri, + support_realm_url, urlunsplit(("", "", reverse("support"), urlencode({"q": realm.string_id}), "")), ) return support_url diff --git a/corporate/views/portico.py b/corporate/views/portico.py index 96ad79760f..9cbddcae12 100644 --- a/corporate/views/portico.py +++ b/corporate/views/portico.py @@ -336,7 +336,7 @@ def communities_view(request: HttpRequest) -> HttpResponse: { "id": realm.id, "name": realm.name, - "realm_url": realm.uri, + "realm_url": realm.url, "logo_url": get_realm_icon_url(realm), "description": get_realm_text_description(realm), "org_type_key": org_type, diff --git a/templates/corporate/support/realm_details.html b/templates/corporate/support/realm_details.html index a277971fe1..56b92d0f9a 100644 --- a/templates/corporate/support/realm_details.html +++ b/templates/corporate/support/realm_details.html @@ -1,7 +1,7 @@
Cloud realm

{{ realm.name }}

- URL: {{ realm.uri }} | + URL: {{ realm.url }} | stats | activity
Date created: {{ realm.date_created|timesince }} ago
diff --git a/templates/zerver/development/dev_login.html b/templates/zerver/development/dev_login.html index fc762273f5..395a7f0aa3 100644 --- a/templates/zerver/development/dev_login.html +++ b/templates/zerver/development/dev_login.html @@ -25,7 +25,7 @@ page can be easily identified in it's respective JavaScript file --> {% if realm_web_public_access_enabled %}

{{_('Anonymous user') }}

-

{% endif %} @@ -33,7 +33,7 @@ page can be easily identified in it's respective JavaScript file --> {% if direct_owners %} {% for direct_owner in direct_owners %}

-