From cc32634439e14e9768fac1ea528663d48f53b8a8 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 19 Oct 2017 20:10:32 -0700 Subject: [PATCH] subdomains: Simplify is_subdomain_root_or_alias. This logic is equivalent, though it takes a couple of readings to convince oneself of that. This version should then be easier to reason about. --- zerver/lib/subdomains.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zerver/lib/subdomains.py b/zerver/lib/subdomains.py index 88df7ef31f..4adc120388 100644 --- a/zerver/lib/subdomains.py +++ b/zerver/lib/subdomains.py @@ -23,9 +23,7 @@ def get_subdomain(request): def is_subdomain_root_or_alias(request): # type: (HttpRequest) -> bool - subdomain = _extract_subdomain(request) - return (subdomain == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN - or subdomain in settings.ROOT_SUBDOMAIN_ALIASES) + return get_subdomain(request) == Realm.SUBDOMAIN_FOR_ROOT_DOMAIN def user_matches_subdomain(realm_subdomain, user_profile): # type: (Optional[Text], UserProfile) -> bool