mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
settings: Extract settings.ZILENCER_ENABLED.
This commit is contained in:
@@ -33,7 +33,7 @@ from six import text_type
|
|||||||
from typing import Union, Any, Callable, Sequence, Dict, Optional
|
from typing import Union, Any, Callable, Sequence, Dict, Optional
|
||||||
from zerver.lib.str_utils import force_bytes
|
from zerver.lib.str_utils import force_bytes
|
||||||
|
|
||||||
if settings.ZULIP_COM:
|
if settings.ZILENCER_ENABLED:
|
||||||
from zilencer.models import get_deployment_by_domain, Deployment
|
from zilencer.models import get_deployment_by_domain, Deployment
|
||||||
else:
|
else:
|
||||||
from mock import Mock
|
from mock import Mock
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from django.core.management.base import BaseCommand
|
|||||||
from zerver.lib.actions import do_create_realm, set_default_streams
|
from zerver.lib.actions import do_create_realm, set_default_streams
|
||||||
from zerver.models import RealmAlias
|
from zerver.models import RealmAlias
|
||||||
|
|
||||||
if not settings.VOYAGER:
|
if settings.ZILENCER_ENABLED:
|
||||||
from zilencer.models import Deployment
|
from zilencer.models import Deployment
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@@ -69,7 +69,7 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
|
|||||||
print("\033[1;31mExternal deployments cannot be open realms.\033[0m\n", file=sys.stderr)
|
print("\033[1;31mExternal deployments cannot be open realms.\033[0m\n", file=sys.stderr)
|
||||||
self.print_help("python manage.py", "create_realm")
|
self.print_help("python manage.py", "create_realm")
|
||||||
exit(1)
|
exit(1)
|
||||||
if options["deployment_id"] is not None and settings.VOYAGER:
|
if options["deployment_id"] is not None and not settings.ZILENCER_ENABLED:
|
||||||
print("\033[1;31mExternal deployments are not supported on voyager deployments.\033[0m\n", file=sys.stderr)
|
print("\033[1;31mExternal deployments are not supported on voyager deployments.\033[0m\n", file=sys.stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Usage: python manage.py create_realm --domain=foo.com --name='Foo, Inc.'"""
|
|||||||
deployment.realms.add(realm)
|
deployment.realms.add(realm)
|
||||||
deployment.save()
|
deployment.save()
|
||||||
print("Added to deployment", str(deployment.id))
|
print("Added to deployment", str(deployment.id))
|
||||||
elif settings.ZULIP_COM:
|
elif settings.PRODUCTION and settings.ZILENCER_ENABLED:
|
||||||
deployment = Deployment.objects.get(base_site_url="https://zulip.com/")
|
deployment = Deployment.objects.get(base_site_url="https://zulip.com/")
|
||||||
deployment.realms.add(realm)
|
deployment.realms.add(realm)
|
||||||
deployment.save()
|
deployment.save()
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def queue_digest_recipient(user_profile, cutoff):
|
|||||||
|
|
||||||
def domains_for_this_deployment():
|
def domains_for_this_deployment():
|
||||||
# type: () -> List[str]
|
# type: () -> List[str]
|
||||||
if settings.ZULIP_COM:
|
if settings.ZILENCER_ENABLED:
|
||||||
# Voyager deployments don't have a Deployment entry.
|
# Voyager deployments don't have a Deployment entry.
|
||||||
# Only send zulip.com digests on staging.
|
# Only send zulip.com digests on staging.
|
||||||
from zilencer.models import Deployment
|
from zilencer.models import Deployment
|
||||||
|
|||||||
@@ -313,6 +313,8 @@ INSTALLED_APPS = [
|
|||||||
'zerver',
|
'zerver',
|
||||||
] + EXTRA_INSTALLED_APPS
|
] + EXTRA_INSTALLED_APPS
|
||||||
|
|
||||||
|
ZILENCER_ENABLED = 'zilencer' in INSTALLED_APPS
|
||||||
|
|
||||||
# Base URL of the Tornado server
|
# Base URL of the Tornado server
|
||||||
# We set it to None when running backend tests or populate_db.
|
# We set it to None when running backend tests or populate_db.
|
||||||
# We override the port number when running frontend tests.
|
# We override the port number when running frontend tests.
|
||||||
|
|||||||
Reference in New Issue
Block a user