register: Ask which review site for how found zulip.

This commit is contained in:
Aman Agrawal 2024-09-27 05:47:59 +00:00 committed by Tim Abbott
parent bdf16b7b4d
commit b6c37a3474
6 changed files with 17 additions and 6 deletions

View File

@ -254,6 +254,7 @@ def realm_summary_table(export: bool) -> str:
if how_found in ( if how_found in (
RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["other"], RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["other"],
RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["ad"], RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["ad"],
RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["review_site"],
): ):
row["how_realm_creator_found_zulip"] += f": {extra_context}" row["how_realm_creator_found_zulip"] += f": {extra_context}"
elif how_found == RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["existing_user"]: elif how_found == RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["existing_user"]:

View File

@ -210,9 +210,10 @@ Form is validated both client-side using jquery-validation (see signup.js) and s
<option value="{{ option_id }}">{{ option_name }}</option> <option value="{{ option_id }}">{{ option_name }}</option>
{% endfor %} {% endfor %}
</select> </select>
<input id="how-realm-creator-found-zulip-other" type="text" placeholder="{{ _('Please describe') }}" name="how_realm_creator_found_zulip_other_text" maxlength="100"/> <input id="how-realm-creator-found-zulip-other" class="how-found-zulip-extra-data-input" type="text" placeholder="{{ _('Please describe') }}" name="how_realm_creator_found_zulip_other_text" maxlength="100"/>
<input id="how-realm-creator-found-zulip-where-ad" type="text" placeholder="{{ _('Where did you see the ad?') }}" name="how_realm_creator_found_zulip_where_ad" maxlength="100"/> <input id="how-realm-creator-found-zulip-where-ad" class="how-found-zulip-extra-data-input" type="text" placeholder="{{ _('Where did you see the ad?') }}" name="how_realm_creator_found_zulip_where_ad" maxlength="100"/>
<input id="how-realm-creator-found-zulip-which-organization" type="text" placeholder="{{ _('Which organization?') }}" name="how_realm_creator_found_zulip_which_organization" maxlength="100"/> <input id="how-realm-creator-found-zulip-which-organization" class="how-found-zulip-extra-data-input" type="text" placeholder="{{ _('Which organization?') }}" name="how_realm_creator_found_zulip_which_organization" maxlength="100"/>
<input id="how-realm-creator-found-zulip-review-site" class="how-found-zulip-extra-data-input" type="text" placeholder="{{ _('Which one?') }}" name="how_realm_creator_found_zulip_review_site" maxlength="100"/>
</div> </div>
{% endif %} {% endif %}

View File

@ -312,6 +312,7 @@ $(() => {
["other", "how-realm-creator-found-zulip-other"], ["other", "how-realm-creator-found-zulip-other"],
["ad", "how-realm-creator-found-zulip-where-ad"], ["ad", "how-realm-creator-found-zulip-where-ad"],
["existing_user", "how-realm-creator-found-zulip-which-organization"], ["existing_user", "how-realm-creator-found-zulip-which-organization"],
["review_site", "how-realm-creator-found-zulip-review-site"],
]); ]);
const hideElement = (element: string): void => { const hideElement = (element: string): void => {

View File

@ -1464,9 +1464,7 @@ button#register_auth_button_gitlab {
top: -5px; top: -5px;
} }
#how-realm-creator-found-zulip-where-ad, #how-realm-creator-found-zulip .how-found-zulip-extra-data-input {
#how-realm-creator-found-zulip-other,
#how-realm-creator-found-zulip-which-organization {
margin-top: 5px; margin-top: 5px;
display: none; display: none;
} }

View File

@ -206,6 +206,9 @@ class RegistrationForm(RealmDetailsForm):
self.fields["how_realm_creator_found_zulip_which_organization"] = forms.CharField( self.fields["how_realm_creator_found_zulip_which_organization"] = forms.CharField(
max_length=100, required=False max_length=100, required=False
) )
self.fields["how_realm_creator_found_zulip_review_site"] = forms.CharField(
max_length=100, required=False
)
def clean_full_name(self) -> str: def clean_full_name(self) -> str:
try: try:

View File

@ -506,6 +506,13 @@ def registration_helper(
how_realm_creator_found_zulip_extra_context = form.cleaned_data[ how_realm_creator_found_zulip_extra_context = form.cleaned_data[
"how_realm_creator_found_zulip_which_organization" "how_realm_creator_found_zulip_which_organization"
] ]
elif (
how_realm_creator_found_zulip
== RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["review_site"]
): # nocoverage
how_realm_creator_found_zulip_extra_context = form.cleaned_data[
"how_realm_creator_found_zulip_review_site"
]
realm = do_create_realm( realm = do_create_realm(
string_id, string_id,