mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	forms.HomepageForm: Rename subdomain to string_id.
No change to behavior.
This commit is contained in:
		@@ -108,9 +108,9 @@ class HomepageForm(forms.Form):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
        # type: (*Any, **Any) -> None
 | 
			
		||||
        self.subdomain = kwargs.get("subdomain")
 | 
			
		||||
        if "subdomain" in kwargs:
 | 
			
		||||
            del kwargs["subdomain"]
 | 
			
		||||
        self.string_id = kwargs.get("string_id")
 | 
			
		||||
        if "string_id" in kwargs:
 | 
			
		||||
            del kwargs["string_id"]
 | 
			
		||||
        super(HomepageForm, self).__init__(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    def clean_email(self):
 | 
			
		||||
@@ -124,8 +124,8 @@ class HomepageForm(forms.Form):
 | 
			
		||||
 | 
			
		||||
        # Otherwise, the user is trying to join a specific realm.
 | 
			
		||||
        realm = None
 | 
			
		||||
        if self.subdomain:
 | 
			
		||||
            realm = get_realm_by_string_id(self.subdomain)
 | 
			
		||||
        if self.string_id:
 | 
			
		||||
            realm = get_realm_by_string_id(self.string_id)
 | 
			
		||||
        elif not settings.REALMS_HAVE_SUBDOMAINS:
 | 
			
		||||
            realm = get_realm(resolve_email_to_domain(email))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -319,19 +319,19 @@ def accounts_accept_terms(request):
 | 
			
		||||
def create_homepage_form(request, user_info=None):
 | 
			
		||||
    # type: (HttpRequest, Optional[Dict[str, Any]]) -> HomepageForm
 | 
			
		||||
    if settings.REALMS_HAVE_SUBDOMAINS:
 | 
			
		||||
        subdomain = get_subdomain(request)
 | 
			
		||||
        string_id = get_subdomain(request)
 | 
			
		||||
    else:
 | 
			
		||||
        realm = get_realm(request.session.get("domain"))
 | 
			
		||||
        if realm is not None:
 | 
			
		||||
            subdomain = realm.string_id
 | 
			
		||||
            string_id = realm.string_id
 | 
			
		||||
        else:
 | 
			
		||||
            subdomain = ''
 | 
			
		||||
            string_id = ''
 | 
			
		||||
 | 
			
		||||
    if user_info:
 | 
			
		||||
        return HomepageForm(user_info, subdomain = subdomain)
 | 
			
		||||
        return HomepageForm(user_info, string_id = string_id)
 | 
			
		||||
    # An empty fields dict is not treated the same way as not
 | 
			
		||||
    # providing it.
 | 
			
		||||
    return HomepageForm(subdomain = subdomain)
 | 
			
		||||
    return HomepageForm(string_id = string_id)
 | 
			
		||||
 | 
			
		||||
def create_preregistration_user(email, request, realm_creation=False):
 | 
			
		||||
    # type: (text_type, HttpRequest, bool) -> HttpResponse
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user