mirror of https://github.com/zulip/zulip.git
signup: Set oldest account as default option in import settings.
Fixes: #11018
This commit is contained in:
parent
d999e79a8b
commit
e5f7d65231
|
@ -104,16 +104,20 @@ 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 another Zulip account') }}</label>
|
||||
<label for="source_realm" 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">
|
||||
<option value="on"
|
||||
{% if ("source_realm" in form.data and form.data["source_realm"] == "on")
|
||||
or "source_realm" not in form.data %}selected {% endif %}>{{ _('Don’t import settings') }}
|
||||
{% if "source_realm" in form.data and form.data["source_realm"] == "on" %}selected {% endif %}>
|
||||
{{ _('Don’t import settings') }}
|
||||
</option>
|
||||
{% for account in accounts %}
|
||||
<option value="{{ account.string_id }}" data-full-name="{{account.full_name}}" data-avatar="{{account.avatar}}" {% if "source_realm" in form.data and account.string_id == form.data["source_realm"] %} selected {% endif %}>{{ account.realm_name }}</option>
|
||||
<option value="{{ account.string_id }}" data-full-name="{{account.full_name}}" data-avatar="{{account.avatar}}"
|
||||
{% if ("source_realm" in form.data and account.string_id == form.data["source_realm"])
|
||||
or ("source_realm" not in form.data and loop.index0 == 0) %} selected {% endif %}>
|
||||
{{ account.realm_name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -185,8 +185,8 @@ def access_user_by_id(user_profile: UserProfile, user_id: int,
|
|||
def get_accounts_for_email(email: str) -> List[Dict[str, Optional[str]]]:
|
||||
profiles = UserProfile.objects.select_related('realm').filter(delivery_email__iexact=email.strip(),
|
||||
is_active=True,
|
||||
is_bot=False,
|
||||
realm__deactivated=False)
|
||||
realm__deactivated=False,
|
||||
is_bot=False).order_by('date_joined')
|
||||
return [{"realm_name": profile.realm.name,
|
||||
"string_id": profile.realm.string_id,
|
||||
"full_name": profile.full_name,
|
||||
|
|
|
@ -2221,6 +2221,17 @@ class UserSignUpTest(ZulipTestCase):
|
|||
confirmation_url = self.get_confirmation_url_from_outbox(email)
|
||||
result = self.client_get(confirmation_url, subdomain=subdomain)
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
result = self.client_post(
|
||||
'/accounts/register/',
|
||||
{'password': password,
|
||||
'key': find_key_by_email(email),
|
||||
'from_confirmation': '1'},
|
||||
subdomain=subdomain)
|
||||
self.assert_in_success_response(["Import settings from existing Zulip account",
|
||||
"selected >\n Zulip Dev",
|
||||
"We just need you to do one last thing."], result)
|
||||
|
||||
result = self.submit_reg_form_for_user(email, password, source_realm="zulip",
|
||||
HTTP_HOST=subdomain + ".testserver")
|
||||
|
||||
|
|
Loading…
Reference in New Issue