home: Pass realm to build_page_params_for_home_page_load.

This is preparation for this needing to be a separate parameter from
the user.
This commit is contained in:
Tim Abbott 2020-10-01 15:00:28 -07:00
parent 18d852de49
commit 351d73ac5a
2 changed files with 6 additions and 1 deletions

View File

@ -103,6 +103,7 @@ def get_user_permission_info(user_profile: Optional[UserProfile]) -> UserPermiss
def build_page_params_for_home_page_load(
request: HttpRequest,
user_profile: UserProfile,
realm: Realm,
insecure_desktop_app: bool,
has_mobile_devices: bool,
narrow: List[List[str]],

View File

@ -8,6 +8,7 @@ from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.cache import patch_cache_control
from zerver.context_processors import get_valid_realm_from_request
from zerver.decorator import zulip_login_required
from zerver.forms import ToSForm
from zerver.lib.actions import do_change_tos_version, realm_user_count
@ -150,9 +151,11 @@ def home_real(request: HttpRequest) -> HttpResponse:
if request.user.is_authenticated:
user_profile = request.user
realm = user_profile.realm
else: # nocoverage
# This code path should not be reachable because of zulip_login_required above.
# user_profile=None corresponds to the logged-out "web_public" visitor case.
user_profile = None
realm = get_valid_realm_from_request(request)
update_last_reminder(user_profile)
@ -185,6 +188,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
queue_id, page_params = build_page_params_for_home_page_load(
request=request,
user_profile=user_profile,
realm=realm,
insecure_desktop_app=insecure_desktop_app,
has_mobile_devices=has_mobile_devices,
narrow=narrow,