mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
registration: Use a loop to set extra content value.
This commit is contained in:
@@ -632,34 +632,19 @@ def registration_helper(
|
|||||||
form.cleaned_data["how_realm_creator_found_zulip"]
|
form.cleaned_data["how_realm_creator_found_zulip"]
|
||||||
]
|
]
|
||||||
how_realm_creator_found_zulip_extra_context = ""
|
how_realm_creator_found_zulip_extra_context = ""
|
||||||
if (
|
extra_context_options = {
|
||||||
how_realm_creator_found_zulip
|
"other": "how_realm_creator_found_zulip_other_text",
|
||||||
== RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["other"]
|
"ad": "how_realm_creator_found_zulip_where_ad",
|
||||||
):
|
"existing_user": "how_realm_creator_found_zulip_which_organization",
|
||||||
how_realm_creator_found_zulip_extra_context = form.cleaned_data[
|
"review_site": "how_realm_creator_found_zulip_review_site",
|
||||||
"how_realm_creator_found_zulip_other_text"
|
}
|
||||||
]
|
for option, field_name in extra_context_options.items():
|
||||||
elif (
|
if (
|
||||||
how_realm_creator_found_zulip
|
how_realm_creator_found_zulip
|
||||||
== RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["ad"]
|
== RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS[option]
|
||||||
):
|
):
|
||||||
how_realm_creator_found_zulip_extra_context = form.cleaned_data[
|
how_realm_creator_found_zulip_extra_context = form.cleaned_data[field_name]
|
||||||
"how_realm_creator_found_zulip_where_ad"
|
break
|
||||||
]
|
|
||||||
elif (
|
|
||||||
how_realm_creator_found_zulip
|
|
||||||
== RealmAuditLog.HOW_REALM_CREATOR_FOUND_ZULIP_OPTIONS["existing_user"]
|
|
||||||
):
|
|
||||||
how_realm_creator_found_zulip_extra_context = form.cleaned_data[
|
|
||||||
"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,
|
||||||
|
|||||||
Reference in New Issue
Block a user