models.py: Disable unique_open_realm feature when realms have subdomains.

This commit is contained in:
Rishi Gupta 2016-11-05 16:07:13 -07:00 committed by Tim Abbott
parent 35481014a4
commit 6e517b2dec
1 changed files with 4 additions and 2 deletions

View File

@ -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