mirror of https://github.com/zulip/zulip.git
models: Add support for using the root subdomain.
Previously, realm.uri and realm.host didn't support using a subdomain of the empty string (""), aka using the root domain. Also, since we're already accessing self.subdomain, we don't need to check REALMS_HAVE_SUBDOMAINS again.
This commit is contained in:
parent
f46f3871b4
commit
93fb6a1688
|
@ -248,7 +248,7 @@ class Realm(ModelReprMixin, models.Model):
|
|||
@property
|
||||
def uri(self):
|
||||
# type: () -> str
|
||||
if settings.REALMS_HAVE_SUBDOMAINS and self.subdomain is not None:
|
||||
if self.subdomain not in [None, ""]:
|
||||
return '%s%s.%s' % (settings.EXTERNAL_URI_SCHEME,
|
||||
self.subdomain, settings.EXTERNAL_HOST)
|
||||
return settings.SERVER_URI
|
||||
|
@ -256,7 +256,7 @@ class Realm(ModelReprMixin, models.Model):
|
|||
@property
|
||||
def host(self):
|
||||
# type: () -> str
|
||||
if settings.REALMS_HAVE_SUBDOMAINS and self.subdomain is not None:
|
||||
if self.subdomain not in [None, ""]:
|
||||
return "%s.%s" % (self.subdomain, settings.EXTERNAL_HOST)
|
||||
return settings.EXTERNAL_HOST
|
||||
|
||||
|
|
Loading…
Reference in New Issue