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.

registration: Rename source_realm field to source_realm_id.

Siddharth Asthana55da3329effd
diff --git a/templates/zerver/register.html b/templates/zerver/register.html
index d4a67bad759..44dc0470c28 100644
--- a/templates/zerver/register.html
+++ b/templates/zerver/register.html
@@ -107,18 +107,18 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
{% if accounts %}
<div class="input-box">
- <label for="source_realm" class="inline-block">{{ _('Import settings from existing Zulip account') }}</label>
+ <label for="source_realm_id" class="inline-block">{{ _('Import settings from existing Zulip account') }}</label>
</div>
<div id="source_realm_select_section" class="input-group m-10 inline-block">
- <select class="select" name="source_realm" id="source_realm_select">
+ <select class="select" name="source_realm_id" id="source_realm_select">
<option value=""
- {% if "source_realm" in form.data and form.data["source_realm"] == "" %}selected {% endif %}>
+ {% if "source_realm_id" in form.data and form.data["source_realm_id"] == "" %}selected {% endif %}>
{{ _('Don&rsquo;t import settings') }}
</option>
{% for account in accounts %}
<option value="{{ account.realm_id }}" data-full-name="{{account.full_name}}" data-avatar="{{account.avatar}}"
- {% if ("source_realm" in form.data and account.realm_id == form.data["source_realm"]|int)
- or ("source_realm" not in form.data and loop.index0 == 0) %} selected {% endif %}>
+ {% if ("source_realm_id" in form.data and account.realm_id == form.data["source_realm_id"]|int)
+ or ("source_realm_id" not in form.data and loop.index0 == 0) %} selected {% endif %}>
{{ account.realm_name }}
</option>
{% endfor %}
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index 06244ad0533..8de3adf7705 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -611,7 +611,7 @@ Output:
timezone: str = "",
realm_in_root_domain: Optional[str] = None,
default_stream_groups: Sequence[str] = [],
- source_realm: str = "",
+ source_realm_id: str = "",
key: Optional[str] = None,
**kwargs: Any,
) -> HttpResponse:
@@ -635,7 +635,7 @@ Output:
"terms": True,
"from_confirmation": from_confirmation,
"default_stream_group": default_stream_groups,
- "source_realm": source_realm,
+ "source_realm_id": source_realm_id,
}
if realm_in_root_domain is not None:
payload["realm_in_root_domain"] = realm_in_root_domain
diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py
index f44e29f292e..10edf60b63e 100644
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -3611,7 +3611,7 @@ class UserSignUpTest(InviteUserBase):
result = self.client_get(confirmation_url, subdomain=subdomain)
self.assertEqual(result.status_code, 200)
result = self.submit_reg_form_for_user(
- email, password, source_realm="", HTTP_HOST=subdomain + ".testserver"
+ email, password, source_realm_id="", HTTP_HOST=subdomain + ".testserver"
)
hamlet = get_user(self.example_email("hamlet"), realm)
@@ -3667,7 +3667,7 @@ class UserSignUpTest(InviteUserBase):
result = self.submit_reg_form_for_user(
email,
password,
- source_realm=str(hamlet_in_zulip.realm.id),
+ source_realm_id=str(hamlet_in_zulip.realm.id),
HTTP_HOST=subdomain + ".testserver",
)
@@ -3750,7 +3750,7 @@ class UserSignUpTest(InviteUserBase):
password,
realm_subdomain=realm.string_id,
realm_name=realm_name,
- source_realm=str(realm.id),
+ source_realm_id=str(realm.id),
)
self.assert_in_success_response(
[
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index 2e447a3457a..a973be0d3d9 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -311,7 +311,7 @@ def accounts_register(request: HttpRequest) -> HttpResponse:
if "timezone" in request.POST and request.POST["timezone"] in pytz.all_timezones_set:
timezone = request.POST["timezone"]
- if "source_realm" in request.POST and request.POST["source_realm"] != "":
+ if "source_realm_id" in request.POST and request.POST["source_realm_id"] != "":
source_profile: Optional[UserProfile] = get_source_profile(
email, int(request.POST["source_realm_id"])
)