diff --git a/zerver/models.py b/zerver/models.py index 5063201dde..77b9338820 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -108,8 +108,10 @@ def completely_open(domain): def get_unique_open_realm(): # type: () -> Optional[Realm] - """We only return a realm if there is a unique non-system-only realm - and it is completely open.""" + """We only return a realm if there is a unique non-system-only realm, + it is completely open, and there are no subdomains.""" + if settings.REALMS_HAVE_SUBDOMAINS: + return None realms = Realm.objects.filter(deactivated=False) # On production installations, the (usually "zulip.com") system # realm is an empty realm just used for system bots, so don't