mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	home: Refactor emojiset and billing logic for None UserProfile.
This commit is contained in:
		@@ -277,7 +277,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
 | 
			
		||||
 | 
			
		||||
    show_billing = False
 | 
			
		||||
    show_plans = False
 | 
			
		||||
    if settings.CORPORATE_ENABLED:
 | 
			
		||||
    if settings.CORPORATE_ENABLED and user_profile is not None:
 | 
			
		||||
        from corporate.models import Customer, CustomerPlan
 | 
			
		||||
        if user_profile.is_billing_admin or user_profile.is_realm_admin:
 | 
			
		||||
            customer = Customer.objects.filter(realm=user_profile.realm).first()
 | 
			
		||||
@@ -293,12 +293,16 @@ def home_real(request: HttpRequest) -> HttpResponse:
 | 
			
		||||
        page_params['translation_data'] = get_language_translation_data(request_language)
 | 
			
		||||
 | 
			
		||||
    csp_nonce = generate_random_token(48)
 | 
			
		||||
    emojiset = user_profile.emojiset
 | 
			
		||||
    if emojiset == UserProfile.TEXT_EMOJISET:
 | 
			
		||||
        # If current emojiset is `TEXT_EMOJISET`, then fallback to
 | 
			
		||||
        # GOOGLE_EMOJISET for picking which spritesheet's CSS to
 | 
			
		||||
        # include (and thus how to display emojis in the emoji picker
 | 
			
		||||
        # and composebox typeahead).
 | 
			
		||||
    if user_profile is not None:
 | 
			
		||||
        if user_profile.emojiset == UserProfile.TEXT_EMOJISET:
 | 
			
		||||
            # If current emojiset is `TEXT_EMOJISET`, then fallback to
 | 
			
		||||
            # GOOGLE_EMOJISET for picking which spritesheet's CSS to
 | 
			
		||||
            # include (and thus how to display emojis in the emoji picker
 | 
			
		||||
            # and composebox typeahead).
 | 
			
		||||
            emojiset = UserProfile.GOOGLE_BLOB_EMOJISET
 | 
			
		||||
        else:
 | 
			
		||||
            emojiset = user_profile.emojiset
 | 
			
		||||
    else:  # nocoverage
 | 
			
		||||
        emojiset = UserProfile.GOOGLE_BLOB_EMOJISET
 | 
			
		||||
 | 
			
		||||
    navbar_logo_url = compute_navbar_logo_url(page_params)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user