mirror of https://github.com/zulip/zulip.git
models: Extract zerver.models.realms.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
7001a0dfc0
commit
cd96193768
|
@ -10,7 +10,8 @@ from analytics.models import FillState, RealmCount, StreamCount, UserCount
|
||||||
from analytics.views.stats import rewrite_client_arrays, sort_by_totals, sort_client_labels
|
from analytics.views.stats import rewrite_client_arrays, sort_by_totals, sort_client_labels
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, datetime_to_timestamp
|
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, datetime_to_timestamp
|
||||||
from zerver.models import Client, get_realm
|
from zerver.models import Client
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TestStatsEndpoint(ZulipTestCase):
|
class TestStatsEndpoint(ZulipTestCase):
|
||||||
|
|
|
@ -23,16 +23,8 @@ from zerver.actions.realm_settings import do_change_realm_org_type, do_send_real
|
||||||
from zerver.actions.user_settings import do_change_user_setting
|
from zerver.actions.user_settings import do_change_user_setting
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
||||||
from zerver.models import (
|
from zerver.models import MultiuseInvite, PreregistrationUser, Realm, UserMessage, UserProfile
|
||||||
MultiuseInvite,
|
from zerver.models.realms import OrgTypeEnum, get_org_type_display_name, get_realm
|
||||||
OrgTypeEnum,
|
|
||||||
PreregistrationUser,
|
|
||||||
Realm,
|
|
||||||
UserMessage,
|
|
||||||
UserProfile,
|
|
||||||
get_org_type_display_name,
|
|
||||||
get_realm,
|
|
||||||
)
|
|
||||||
from zilencer.lib.remote_counts import MissingDataError
|
from zilencer.lib.remote_counts import MissingDataError
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -25,7 +25,8 @@ from analytics.views.activity_common import (
|
||||||
from analytics.views.support import get_plan_type_string
|
from analytics.views.support import get_plan_type_string
|
||||||
from zerver.decorator import require_server_admin
|
from zerver.decorator import require_server_admin
|
||||||
from zerver.lib.request import has_request_variables
|
from zerver.lib.request import has_request_variables
|
||||||
from zerver.models import Realm, get_org_type_display_name
|
from zerver.models import Realm
|
||||||
|
from zerver.models.realms import get_org_type_display_name
|
||||||
|
|
||||||
if settings.BILLING_ENABLED:
|
if settings.BILLING_ENABLED:
|
||||||
from corporate.lib.analytics import (
|
from corporate.lib.analytics import (
|
||||||
|
|
|
@ -36,7 +36,8 @@ from zerver.lib.response import json_success
|
||||||
from zerver.lib.streams import access_stream_by_id
|
from zerver.lib.streams import access_stream_by_id
|
||||||
from zerver.lib.timestamp import convert_to_UTC
|
from zerver.lib.timestamp import convert_to_UTC
|
||||||
from zerver.lib.validator import to_non_negative_int
|
from zerver.lib.validator import to_non_negative_int
|
||||||
from zerver.models import Client, Realm, Stream, UserProfile, get_realm
|
from zerver.models import Client, Realm, Stream, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
if settings.ZILENCER_ENABLED:
|
if settings.ZILENCER_ENABLED:
|
||||||
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, RemoteZulipServer
|
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, RemoteZulipServer
|
||||||
|
|
|
@ -40,9 +40,8 @@ from zerver.models import (
|
||||||
Realm,
|
Realm,
|
||||||
RealmReactivationStatus,
|
RealmReactivationStatus,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_org_type_display_name,
|
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_org_type_display_name, get_realm
|
||||||
from zerver.models.users import get_user_profile_by_id
|
from zerver.models.users import get_user_profile_by_id
|
||||||
from zerver.views.invite import get_invitee_emails_set
|
from zerver.views.invite import get_invitee_emails_set
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,8 @@ from zerver.lib.send_email import (
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
||||||
from zerver.lib.url_encoding import append_url_query_string
|
from zerver.lib.url_encoding import append_url_query_string
|
||||||
from zerver.lib.utils import assert_is_not_none
|
from zerver.lib.utils import assert_is_not_none
|
||||||
from zerver.models import Realm, RealmAuditLog, UserProfile, get_org_type_display_name, get_realm
|
from zerver.models import Realm, RealmAuditLog, UserProfile
|
||||||
|
from zerver.models.realms import get_org_type_display_name, get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
from zilencer.lib.remote_counts import MissingDataError
|
from zilencer.lib.remote_counts import MissingDataError
|
||||||
from zilencer.models import (
|
from zilencer.models import (
|
||||||
|
|
|
@ -14,7 +14,8 @@ from corporate.models import (
|
||||||
ZulipSponsorshipRequest,
|
ZulipSponsorshipRequest,
|
||||||
get_current_plan_by_customer,
|
get_current_plan_by_customer,
|
||||||
)
|
)
|
||||||
from zerver.models import Realm, get_org_type_display_name, get_realm
|
from zerver.models import Realm
|
||||||
|
from zerver.models.realms import get_org_type_display_name, get_realm
|
||||||
from zilencer.lib.remote_counts import MissingDataError
|
from zilencer.lib.remote_counts import MissingDataError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@ from zerver.lib.remote_server import send_server_data_to_push_bouncer
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
||||||
from zerver.lib.utils import assert_is_not_none
|
from zerver.lib.utils import assert_is_not_none
|
||||||
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile, get_realm
|
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
from zilencer.lib.remote_counts import MissingDataError
|
from zilencer.lib.remote_counts import MissingDataError
|
||||||
from zilencer.models import (
|
from zilencer.models import (
|
||||||
|
|
|
@ -35,7 +35,7 @@ organization in Zulip). The following files are involved in the process:
|
||||||
|
|
||||||
**Backend**
|
**Backend**
|
||||||
|
|
||||||
- `zerver/models/__init__.py`: Defines the database model.
|
- `zerver/models/realms.py`: Defines the database model.
|
||||||
- `zerver/views/realm.py`: The view function that implements the API endpoint
|
- `zerver/views/realm.py`: The view function that implements the API endpoint
|
||||||
for editing realm objects.
|
for editing realm objects.
|
||||||
- `zerver/actions/realm_settings.py`: Contains code for updating and interacting with the database.
|
- `zerver/actions/realm_settings.py`: Contains code for updating and interacting with the database.
|
||||||
|
@ -73,7 +73,7 @@ organization in Zulip). The following files are involved in the process:
|
||||||
### Adding a field to the database
|
### Adding a field to the database
|
||||||
|
|
||||||
**Update the model:** The server accesses the underlying database in
|
**Update the model:** The server accesses the underlying database in
|
||||||
`zerver/models/__init__.py`. Add a new field in the appropriate class.
|
`zerver/models/realms.py`. Add a new field in the appropriate class.
|
||||||
|
|
||||||
**Create and run the migration:** To create and apply a migration, run the
|
**Create and run the migration:** To create and apply a migration, run the
|
||||||
following commands:
|
following commands:
|
||||||
|
@ -185,10 +185,10 @@ task of requiring messages to have a topic, you can [view this commit](https://g
|
||||||
|
|
||||||
First, update the database and model to store the new setting. Add a new
|
First, update the database and model to store the new setting. Add a new
|
||||||
boolean field, `mandatory_topics`, to the Realm model in
|
boolean field, `mandatory_topics`, to the Realm model in
|
||||||
`zerver/models/__init__.py`.
|
`zerver/models/realms.py`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
# zerver/models/__init__.py
|
# zerver/models/realms.py
|
||||||
|
|
||||||
class Realm(models.Model):
|
class Realm(models.Model):
|
||||||
# ...
|
# ...
|
||||||
|
@ -205,7 +205,7 @@ is the field's type. Add the new field to the `property_types`
|
||||||
dictionary.
|
dictionary.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
# zerver/models/__init__.py
|
# zerver/models/realms.py
|
||||||
|
|
||||||
class Realm(models.Model)
|
class Realm(models.Model)
|
||||||
# ...
|
# ...
|
||||||
|
|
|
@ -66,7 +66,7 @@ django.setup()
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
|
|
|
@ -50,7 +50,8 @@ from zerver.lib.storage import static_path
|
||||||
from zerver.lib.streams import create_stream_if_needed
|
from zerver.lib.streams import create_stream_if_needed
|
||||||
from zerver.lib.upload import upload_avatar_image
|
from zerver.lib.upload import upload_avatar_image
|
||||||
from zerver.lib.webhooks.common import get_fixture_http_headers
|
from zerver.lib.webhooks.common import get_fixture_http_headers
|
||||||
from zerver.models import Message, UserProfile, get_realm
|
from zerver.models import Message, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user_by_delivery_email
|
from zerver.models.users import get_user_by_delivery_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ rules:
|
||||||
- pattern-not: from zerver.models import filter_pattern_validator
|
- pattern-not: from zerver.models import filter_pattern_validator
|
||||||
- pattern-not: from zerver.models import url_template_validator
|
- pattern-not: from zerver.models import url_template_validator
|
||||||
- pattern-not: from zerver.models import generate_email_token_for_stream
|
- pattern-not: from zerver.models import generate_email_token_for_stream
|
||||||
- pattern-not: from zerver.models import generate_realm_uuid_owner_secret
|
- pattern-not: from zerver.models.realms import generate_realm_uuid_owner_secret
|
||||||
- pattern-either:
|
- pattern-either:
|
||||||
- pattern: from zerver import $X
|
- pattern: from zerver import $X
|
||||||
- pattern: from analytics import $X
|
- pattern: from analytics import $X
|
||||||
|
|
|
@ -36,7 +36,7 @@ with test_server_running(
|
||||||
from zerver.actions.users import change_user_is_active
|
from zerver.actions.users import change_user_is_active
|
||||||
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
from zerver.openapi.javascript_examples import test_js_bindings
|
from zerver.openapi.javascript_examples import test_js_bindings
|
||||||
from zerver.openapi.python_examples import (
|
from zerver.openapi.python_examples import (
|
||||||
|
|
|
@ -31,9 +31,8 @@ from zerver.models import (
|
||||||
RealmUserDefault,
|
RealmUserDefault,
|
||||||
Stream,
|
Stream,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_org_type_display_name,
|
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_org_type_display_name, get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
from zproject.backends import all_implemented_backend_names
|
from zproject.backends import all_implemented_backend_names
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,8 @@ from django.db import transaction
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.actions.realm_settings import do_set_realm_property
|
from zerver.actions.realm_settings import do_set_realm_property
|
||||||
from zerver.models import (
|
from zerver.models import Realm, RealmAuditLog, RealmDomain, UserProfile
|
||||||
Realm,
|
from zerver.models.realms import RealmDomainDict, get_realm_domains
|
||||||
RealmAuditLog,
|
|
||||||
RealmDomain,
|
|
||||||
RealmDomainDict,
|
|
||||||
UserProfile,
|
|
||||||
get_realm_domains,
|
|
||||||
)
|
|
||||||
from zerver.models.users import active_user_ids
|
from zerver.models.users import active_user_ids
|
||||||
from zerver.tornado.django_api import send_event_on_commit
|
from zerver.tornado.django_api import send_event_on_commit
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@ from zerver.models import (
|
||||||
Subscription,
|
Subscription,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import active_user_ids
|
from zerver.models.users import active_user_ids
|
||||||
from zerver.tornado.django_api import send_event, send_event_on_commit
|
from zerver.tornado.django_api import send_event, send_event_on_commit
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ from zerver.models import (
|
||||||
UserGroupMembership,
|
UserGroupMembership,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_bot_services,
|
get_bot_services,
|
||||||
get_fake_email_domain,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_fake_email_domain
|
||||||
from zerver.models.users import (
|
from zerver.models.users import (
|
||||||
active_non_guest_user_ids,
|
active_non_guest_user_ids,
|
||||||
active_user_ids,
|
active_user_ids,
|
||||||
|
|
|
@ -20,7 +20,8 @@ from zerver.lib.realm_icon import get_realm_icon_url
|
||||||
from zerver.lib.request import RequestNotes
|
from zerver.lib.request import RequestNotes
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
|
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
|
||||||
from zerver.models import Realm, UserProfile, get_realm
|
from zerver.models import Realm, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zproject.backends import (
|
from zproject.backends import (
|
||||||
AUTH_BACKEND_NAME_MAP,
|
AUTH_BACKEND_NAME_MAP,
|
||||||
auth_enabled_helper,
|
auth_enabled_helper,
|
||||||
|
|
|
@ -35,12 +35,11 @@ from zerver.lib.send_email import FromAddress, send_email
|
||||||
from zerver.lib.soft_deactivation import queue_soft_reactivation
|
from zerver.lib.soft_deactivation import queue_soft_reactivation
|
||||||
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
|
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
|
||||||
from zerver.lib.users import check_full_name
|
from zerver.lib.users import check_full_name
|
||||||
from zerver.models import (
|
from zerver.models import Realm, UserProfile
|
||||||
|
from zerver.models.realms import (
|
||||||
DisposableEmailError,
|
DisposableEmailError,
|
||||||
DomainNotAllowedForRealmError,
|
DomainNotAllowedForRealmError,
|
||||||
EmailContainsPlusError,
|
EmailContainsPlusError,
|
||||||
Realm,
|
|
||||||
UserProfile,
|
|
||||||
get_realm,
|
get_realm,
|
||||||
)
|
)
|
||||||
from zerver.models.users import get_user_by_delivery_email, is_cross_realm_bot_email
|
from zerver.models.users import get_user_by_delivery_email, is_cross_realm_bot_email
|
||||||
|
|
|
@ -591,7 +591,7 @@ def flush_muting_users_cache(*, instance: "MutedUser", **kwargs: object) -> None
|
||||||
cache_delete(get_muting_users_cache_key(mute_object.muted_user_id))
|
cache_delete(get_muting_users_cache_key(mute_object.muted_user_id))
|
||||||
|
|
||||||
|
|
||||||
# Called by models/__init__.py to flush various caches whenever we save
|
# Called by models/realms.py to flush various caches whenever we save
|
||||||
# a Realm object. The main tricky thing here is that Realm info is
|
# a Realm object. The main tricky thing here is that Realm info is
|
||||||
# generally cached indirectly through user_profile objects.
|
# generally cached indirectly through user_profile objects.
|
||||||
def flush_realm(
|
def flush_realm(
|
||||||
|
|
|
@ -18,8 +18,8 @@ from zerver.models import (
|
||||||
Subscription,
|
Subscription,
|
||||||
UserBaseSettings,
|
UserBaseSettings,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_fake_email_domain,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_fake_email_domain
|
||||||
|
|
||||||
|
|
||||||
def copy_default_settings(
|
def copy_default_settings(
|
||||||
|
|
|
@ -8,12 +8,11 @@ from django.utils.translation import gettext as _
|
||||||
from zerver.lib.name_restrictions import is_disposable_domain
|
from zerver.lib.name_restrictions import is_disposable_domain
|
||||||
|
|
||||||
# TODO: Move DisposableEmailError, etc. into here.
|
# TODO: Move DisposableEmailError, etc. into here.
|
||||||
from zerver.models import (
|
from zerver.models import Realm, RealmDomain
|
||||||
|
from zerver.models.realms import (
|
||||||
DisposableEmailError,
|
DisposableEmailError,
|
||||||
DomainNotAllowedForRealmError,
|
DomainNotAllowedForRealmError,
|
||||||
EmailContainsPlusError,
|
EmailContainsPlusError,
|
||||||
Realm,
|
|
||||||
RealmDomain,
|
|
||||||
)
|
)
|
||||||
from zerver.models.users import get_users_by_delivery_email, is_cross_realm_bot_email
|
from zerver.models.users import get_users_by_delivery_email, is_cross_realm_bot_email
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,11 @@ from zerver.models import (
|
||||||
custom_profile_fields_for_realm,
|
custom_profile_fields_for_realm,
|
||||||
get_all_custom_emoji_for_realm,
|
get_all_custom_emoji_for_realm,
|
||||||
get_default_stream_groups,
|
get_default_stream_groups,
|
||||||
get_realm_domains,
|
|
||||||
get_realm_playgrounds,
|
get_realm_playgrounds,
|
||||||
linkifiers_for_realm,
|
linkifiers_for_realm,
|
||||||
)
|
)
|
||||||
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
||||||
|
from zerver.models.realms import get_realm_domains
|
||||||
from zerver.tornado.django_api import get_user_events, request_event_queue
|
from zerver.tornado.django_api import get_user_events, request_event_queue
|
||||||
from zproject.backends import email_auth_enabled, password_auth_enabled
|
from zproject.backends import email_auth_enabled, password_auth_enabled
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ from zerver.models import (
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserStatus,
|
UserStatus,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
||||||
|
|
||||||
# Custom mypy types follow:
|
# Custom mypy types follow:
|
||||||
|
|
|
@ -77,9 +77,9 @@ from zerver.models import (
|
||||||
UserStatus,
|
UserStatus,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_huddle_hash,
|
get_huddle_hash,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
||||||
|
|
||||||
realm_tables = [
|
realm_tables = [
|
||||||
|
|
|
@ -75,11 +75,11 @@ from zerver.models import (
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_display_recipient_by_id,
|
get_display_recipient_by_id,
|
||||||
get_fake_email_domain,
|
|
||||||
get_usermessage_by_message_id,
|
get_usermessage_by_message_id,
|
||||||
query_for_ids,
|
query_for_ids,
|
||||||
)
|
)
|
||||||
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
||||||
|
from zerver.models.realms import get_fake_email_domain
|
||||||
|
|
||||||
|
|
||||||
class MessageDetailsDict(TypedDict, total=False):
|
class MessageDetailsDict(TypedDict, total=False):
|
||||||
|
|
|
@ -65,8 +65,8 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_display_recipient,
|
get_display_recipient,
|
||||||
get_fake_email_domain,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_fake_email_domain
|
||||||
from zerver.models.users import get_user_profile_by_id
|
from zerver.models.users import get_user_profile_by_id
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -22,7 +22,8 @@ from zerver.lib.exceptions import (
|
||||||
)
|
)
|
||||||
from zerver.lib.outgoing_http import OutgoingSession
|
from zerver.lib.outgoing_http import OutgoingSession
|
||||||
from zerver.lib.queue import queue_event_on_commit
|
from zerver.lib.queue import queue_event_on_commit
|
||||||
from zerver.models import OrgTypeEnum, Realm, RealmAuditLog
|
from zerver.models import Realm, RealmAuditLog
|
||||||
|
from zerver.models.realms import OrgTypeEnum
|
||||||
|
|
||||||
|
|
||||||
class PushBouncerSession(OutgoingSession):
|
class PushBouncerSession(OutgoingSession):
|
||||||
|
|
|
@ -15,11 +15,11 @@ from zerver.actions.users import do_change_user_role, do_deactivate_user
|
||||||
from zerver.lib.email_validation import email_allowed_for_realm, validate_email_not_already_in_realm
|
from zerver.lib.email_validation import email_allowed_for_realm, validate_email_not_already_in_realm
|
||||||
from zerver.lib.request import RequestNotes
|
from zerver.lib.request import RequestNotes
|
||||||
from zerver.lib.subdomains import get_subdomain
|
from zerver.lib.subdomains import get_subdomain
|
||||||
from zerver.models import (
|
from zerver.models import UserProfile
|
||||||
|
from zerver.models.realms import (
|
||||||
DisposableEmailError,
|
DisposableEmailError,
|
||||||
DomainNotAllowedForRealmError,
|
DomainNotAllowedForRealmError,
|
||||||
EmailContainsPlusError,
|
EmailContainsPlusError,
|
||||||
UserProfile,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,12 +107,11 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserStatus,
|
UserStatus,
|
||||||
clear_supported_auth_backends_cache,
|
|
||||||
get_realm,
|
|
||||||
get_realm_stream,
|
get_realm_stream,
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import clear_supported_auth_backends_cache, get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
|
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
|
||||||
from zerver.openapi.openapi import validate_against_openapi_schema, validate_request
|
from zerver.openapi.openapi import validate_against_openapi_schema, validate_request
|
||||||
from zerver.tornado.event_queue import clear_client_event_queues_for_testing
|
from zerver.tornado.event_queue import clear_client_event_queues_for_testing
|
||||||
|
|
|
@ -60,9 +60,9 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.tornado.handlers import AsyncDjangoHandler, allocate_handler_id
|
from zerver.tornado.handlers import AsyncDjangoHandler, allocate_handler_id
|
||||||
from zilencer.models import RemoteZulipServer
|
from zilencer.models import RemoteZulipServer
|
||||||
from zproject.backends import ExternalAuthDataDict, ExternalAuthResult
|
from zproject.backends import ExternalAuthDataDict, ExternalAuthResult
|
||||||
|
|
|
@ -36,9 +36,9 @@ from zerver.models import (
|
||||||
Subscription,
|
Subscription,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_fake_email_domain,
|
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_fake_email_domain
|
||||||
from zerver.models.users import (
|
from zerver.models.users import (
|
||||||
active_non_guest_user_ids,
|
active_non_guest_user_ids,
|
||||||
active_user_ids,
|
active_user_ids,
|
||||||
|
|
|
@ -9,7 +9,8 @@ from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.domains import validate_domain
|
from zerver.lib.domains import validate_domain
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import RealmDomain, get_realm_domains
|
from zerver.models import RealmDomain
|
||||||
|
from zerver.models.realms import get_realm_domains
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
|
|
|
@ -13,7 +13,8 @@ from typing_extensions import override
|
||||||
from zerver.lib.email_mirror import mirror_email_message
|
from zerver.lib.email_mirror import mirror_email_message
|
||||||
from zerver.lib.email_mirror_helpers import encode_email_address
|
from zerver.lib.email_mirror_helpers import encode_email_address
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.models import Realm, get_realm, get_stream
|
from zerver.models import Realm, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
# This command loads an email from a specified file and sends it
|
# This command loads an email from a specified file and sends it
|
||||||
# to the email mirror. Simple emails can be passed in a JSON file,
|
# to the email mirror. Simple emails can be passed in a JSON file,
|
||||||
|
|
|
@ -9,7 +9,7 @@ from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.webhooks.common import standardize_headers
|
from zerver.lib.webhooks.common import standardize_headers
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class Command(ZulipBaseCommand):
|
class Command(ZulipBaseCommand):
|
||||||
|
|
|
@ -42,7 +42,8 @@ from zerver.lib.response import (
|
||||||
)
|
)
|
||||||
from zerver.lib.subdomains import get_subdomain
|
from zerver.lib.subdomains import get_subdomain
|
||||||
from zerver.lib.user_agent import parse_user_agent
|
from zerver.lib.user_agent import parse_user_agent
|
||||||
from zerver.models import Realm, get_realm
|
from zerver.models import Realm
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
ParamT = ParamSpec("ParamT")
|
ParamT = ParamSpec("ParamT")
|
||||||
logger = logging.getLogger("zulip.requests")
|
logger = logging.getLogger("zulip.requests")
|
||||||
|
|
|
@ -4,7 +4,7 @@ import uuid
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
from zerver.models import generate_realm_uuid_owner_secret
|
from zerver.models.realms import generate_realm_uuid_owner_secret
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1060,7 +1060,8 @@ def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:
|
||||||
|
|
||||||
|
|
||||||
def get_source_profile(email: str, realm_id: int) -> Optional[UserProfile]:
|
def get_source_profile(email: str, realm_id: int) -> Optional[UserProfile]:
|
||||||
from zerver.models import Realm, get_realm_by_id
|
from zerver.models import Realm
|
||||||
|
from zerver.models.realms import get_realm_by_id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return get_user_by_delivery_email(email, get_realm_by_id(realm_id))
|
return get_user_by_delivery_email(email, get_realm_by_id(realm_id))
|
||||||
|
|
|
@ -20,7 +20,8 @@ from zerver.lib.initial_password import initial_password
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.upload import upload_message_attachment
|
from zerver.lib.upload import upload_message_attachment
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
from zerver.models import Client, Message, UserGroup, UserPresence, get_realm
|
from zerver.models import Client, Message, UserGroup, UserPresence
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {}
|
GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {}
|
||||||
|
|
|
@ -22,7 +22,7 @@ from typing import Any, Callable, Dict, List, Set, TypeVar
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
from zulip import Client
|
from zulip import Client
|
||||||
|
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
from zerver.openapi.openapi import validate_against_openapi_schema
|
from zerver.openapi.openapi import validate_against_openapi_schema
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import markdown
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from zulip import Client
|
from zulip import Client
|
||||||
|
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
from zerver.openapi import markdown_extension
|
from zerver.openapi import markdown_extension
|
||||||
from zerver.openapi.curl_param_value_generators import (
|
from zerver.openapi.curl_param_value_generators import (
|
||||||
AUTHENTICATION_LINE,
|
AUTHENTICATION_LINE,
|
||||||
|
|
|
@ -77,20 +77,18 @@ from zerver.models import (
|
||||||
Message,
|
Message,
|
||||||
Realm,
|
Realm,
|
||||||
RealmAuditLog,
|
RealmAuditLog,
|
||||||
RealmDomainDict,
|
|
||||||
RealmPlayground,
|
RealmPlayground,
|
||||||
Recipient,
|
Recipient,
|
||||||
Subscription,
|
Subscription,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_all_custom_emoji_for_realm,
|
get_all_custom_emoji_for_realm,
|
||||||
get_realm,
|
|
||||||
get_realm_domains,
|
|
||||||
get_realm_playgrounds,
|
get_realm_playgrounds,
|
||||||
get_stream,
|
get_stream,
|
||||||
linkifiers_for_realm,
|
linkifiers_for_realm,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import RealmDomainDict, get_realm, get_realm_domains
|
||||||
|
|
||||||
|
|
||||||
class TestRealmAuditLog(ZulipTestCase):
|
class TestRealmAuditLog(ZulipTestCase):
|
||||||
|
|
|
@ -116,9 +116,8 @@ from zerver.models import (
|
||||||
Stream,
|
Stream,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
clear_supported_auth_backends_cache,
|
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import clear_supported_auth_backends_cache, get_realm
|
||||||
from zerver.models.users import PasswordTooWeakError, get_user_by_delivery_email
|
from zerver.models.users import PasswordTooWeakError, get_user_by_delivery_email
|
||||||
from zerver.signals import JUST_CREATED_THRESHOLD
|
from zerver.signals import JUST_CREATED_THRESHOLD
|
||||||
from zerver.views.auth import log_into_subdomain, maybe_send_to_registration
|
from zerver.views.auth import log_into_subdomain, maybe_send_to_registration
|
||||||
|
|
|
@ -24,9 +24,9 @@ from zerver.models import (
|
||||||
Subscription,
|
Subscription,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_bot_services,
|
get_bot_services,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user, is_cross_realm_bot_email
|
from zerver.models.users import get_user, is_cross_realm_bot_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ from zerver.lib.cache import (
|
||||||
validate_cache_key,
|
validate_cache_key,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import UserProfile, get_realm
|
from zerver.models import UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user, get_user_profile_by_id
|
from zerver.models.users import get_system_bot, get_user, get_user_profile_by_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ from zerver.models import (
|
||||||
CustomProfileFieldValue,
|
CustomProfileFieldValue,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
custom_profile_fields_for_realm,
|
custom_profile_fields_for_realm,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class CustomProfileFieldTestCase(ZulipTestCase):
|
class CustomProfileFieldTestCase(ZulipTestCase):
|
||||||
|
|
|
@ -52,7 +52,8 @@ from zerver.lib.user_agent import parse_user_agent
|
||||||
from zerver.lib.users import get_api_key
|
from zerver.lib.users import get_api_key
|
||||||
from zerver.lib.utils import generate_api_key, has_api_key_format
|
from zerver.lib.utils import generate_api_key, has_api_key_format
|
||||||
from zerver.middleware import LogRequests, parse_client
|
from zerver.middleware import LogRequests, parse_client
|
||||||
from zerver.models import Client, Realm, UserProfile, clear_client_cache, get_realm
|
from zerver.models import Client, Realm, UserProfile, clear_client_cache
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
if settings.ZILENCER_ENABLED:
|
if settings.ZILENCER_ENABLED:
|
||||||
|
|
|
@ -33,9 +33,9 @@ from zerver.models import (
|
||||||
Stream,
|
Stream,
|
||||||
UserActivityInterval,
|
UserActivityInterval,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TestDigestEmailMessages(ZulipTestCase):
|
class TestDigestEmailMessages(ZulipTestCase):
|
||||||
|
|
|
@ -14,7 +14,8 @@ from zerver.context_processors import get_apps_page_url
|
||||||
from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY
|
from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import HostRequestMock
|
from zerver.lib.test_helpers import HostRequestMock
|
||||||
from zerver.models import Realm, get_realm
|
from zerver.models import Realm
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.views.documentation import add_api_url_context
|
from zerver.views.documentation import add_api_url_context
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -18,7 +18,8 @@ from zerver.actions.realm_settings import do_deactivate_realm, do_set_realm_prop
|
||||||
from zerver.actions.user_settings import do_change_user_setting, do_start_email_change_process
|
from zerver.actions.user_settings import do_change_user_setting, do_start_email_change_process
|
||||||
from zerver.actions.users import do_deactivate_user
|
from zerver.actions.users import do_deactivate_user
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import EmailChangeStatus, UserProfile, get_realm
|
from zerver.models import EmailChangeStatus, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user, get_user_by_delivery_email, get_user_profile_by_id
|
from zerver.models.users import get_user, get_user_by_delivery_email, get_user_profile_by_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ from zerver.lib.send_email import FromAddress
|
||||||
from zerver.lib.streams import ensure_stream
|
from zerver.lib.streams import ensure_stream
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import mock_queue_publish, most_recent_message, most_recent_usermessage
|
from zerver.lib.test_helpers import mock_queue_publish, most_recent_message, most_recent_usermessage
|
||||||
from zerver.models import Attachment, Recipient, Stream, UserProfile, get_realm, get_stream
|
from zerver.models import Attachment, Recipient, Stream, UserProfile, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
from zerver.worker.queue_processors import MirrorWorker
|
from zerver.worker.queue_processors import MirrorWorker
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ from zerver.lib.send_email import (
|
||||||
send_custom_server_email,
|
send_custom_server_email,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Realm, ScheduledEmail, UserProfile, get_realm
|
from zerver.models import Realm, ScheduledEmail, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zilencer.models import RemoteZulipServer
|
from zilencer.models import RemoteZulipServer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.bot_lib import EmbeddedBotQuitError
|
from zerver.lib.bot_lib import EmbeddedBotQuitError
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import UserProfile, get_display_recipient, get_realm, get_service_profile
|
from zerver.models import UserProfile, get_display_recipient, get_service_profile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ from zerver.models import (
|
||||||
UserPresence,
|
UserPresence,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
from zerver.tornado.event_queue import (
|
from zerver.tornado.event_queue import (
|
||||||
allocate_client_descriptor,
|
allocate_client_descriptor,
|
||||||
|
|
|
@ -11,7 +11,8 @@ from zerver.lib.streams import access_stream_for_send_message
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import most_recent_message
|
from zerver.lib.test_helpers import most_recent_message
|
||||||
from zerver.lib.users import is_administrator_role
|
from zerver.lib.users import is_administrator_role
|
||||||
from zerver.models import UserProfile, UserStatus, get_realm, get_stream
|
from zerver.models import UserProfile, UserStatus, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user_by_delivery_email
|
from zerver.models.users import get_user_by_delivery_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ import time_machine
|
||||||
from zerver.data_import.gitter import do_convert_data, get_usermentions
|
from zerver.data_import.gitter import do_convert_data, get_usermentions
|
||||||
from zerver.lib.import_realm import do_import_realm
|
from zerver.lib.import_realm import do_import_realm
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Message, UserProfile, get_realm
|
from zerver.models import Message, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zproject.backends import (
|
from zproject.backends import (
|
||||||
AUTH_BACKEND_NAME_MAP,
|
AUTH_BACKEND_NAME_MAP,
|
||||||
GitHubAuthBackend,
|
GitHubAuthBackend,
|
||||||
|
|
|
@ -24,15 +24,8 @@ from zerver.lib.soft_deactivation import do_soft_deactivate_users
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import get_user_messages, queries_captured
|
from zerver.lib.test_helpers import get_user_messages, queries_captured
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp
|
from zerver.lib.timestamp import datetime_to_timestamp
|
||||||
from zerver.models import (
|
from zerver.models import DefaultStream, Draft, Realm, UserActivity, UserProfile, get_stream
|
||||||
DefaultStream,
|
from zerver.models.realms import get_realm
|
||||||
Draft,
|
|
||||||
Realm,
|
|
||||||
UserActivity,
|
|
||||||
UserProfile,
|
|
||||||
get_realm,
|
|
||||||
get_stream,
|
|
||||||
)
|
|
||||||
from zerver.models.users import get_system_bot, get_user
|
from zerver.models.users import get_system_bot, get_user
|
||||||
from zerver.worker.queue_processors import UserActivityWorker
|
from zerver.worker.queue_processors import UserActivityWorker
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ from zerver.lib.hotspots import (
|
||||||
get_next_onboarding_steps,
|
get_next_onboarding_steps,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import OnboardingStep, UserProfile, get_realm
|
from zerver.models import OnboardingStep, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
# Splitting this out, since I imagine this will eventually have most of the
|
# Splitting this out, since I imagine this will eventually have most of the
|
||||||
|
|
|
@ -86,10 +86,10 @@ from zerver.models import (
|
||||||
get_active_streams,
|
get_active_streams,
|
||||||
get_client,
|
get_client,
|
||||||
get_huddle_hash,
|
get_huddle_hash,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user_by_delivery_email
|
from zerver.models.users import get_system_bot, get_user_by_delivery_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ import orjson
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Message, Stream, get_realm
|
from zerver.models import Message, Stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,10 @@ from zerver.models import (
|
||||||
UserGroup,
|
UserGroup,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user_by_delivery_email
|
from zerver.models.users import get_user_by_delivery_email
|
||||||
from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES, get_invitee_emails_set
|
from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES, get_invitee_emails_set
|
||||||
from zerver.views.registration import accounts_home
|
from zerver.views.registration import accounts_home
|
||||||
|
|
|
@ -20,7 +20,8 @@ from zerver.actions.reactions import do_add_reaction
|
||||||
from zerver.lib.management import ZulipBaseCommand, check_config
|
from zerver.lib.management import ZulipBaseCommand, check_config
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import most_recent_message, stdout_suppressed
|
from zerver.lib.test_helpers import most_recent_message, stdout_suppressed
|
||||||
from zerver.models import Message, Reaction, Realm, Recipient, UserProfile, get_realm, get_stream
|
from zerver.models import Message, Reaction, Realm, Recipient, UserProfile, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user_profile_by_email
|
from zerver.models.users import get_user_profile_by_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
linkifiers_for_realm,
|
linkifiers_for_realm,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class SimulatedFencedBlockPreprocessor(FencedBlockPreprocessor):
|
class SimulatedFencedBlockPreprocessor(FencedBlockPreprocessor):
|
||||||
|
|
|
@ -28,7 +28,8 @@ from zerver.data_import.user_handler import UserHandler
|
||||||
from zerver.lib.emoji import name_to_codepoint
|
from zerver.lib.emoji import name_to_codepoint
|
||||||
from zerver.lib.import_realm import do_import_realm
|
from zerver.lib.import_realm import do_import_realm
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm
|
from zerver.models import Message, Reaction, Recipient, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ from zerver.models import (
|
||||||
Stream,
|
Stream,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_display_recipient,
|
get_display_recipient,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class MessageDictTest(ZulipTestCase):
|
class MessageDictTest(ZulipTestCase):
|
||||||
|
|
|
@ -38,11 +38,11 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||||
|
|
|
@ -58,9 +58,9 @@ from zerver.models import (
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_display_recipient,
|
get_display_recipient,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.views.message_fetch import get_messages_backend
|
from zerver.views.message_fetch import get_messages_backend
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -33,9 +33,9 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||||
|
|
|
@ -33,9 +33,9 @@ from zerver.models import (
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_name_keyed_dict_for_active_realm_emoji,
|
get_name_keyed_dict_for_active_realm_emoji,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TestMessageNotificationEmails(ZulipTestCase):
|
class TestMessageNotificationEmails(ZulipTestCase):
|
||||||
|
|
|
@ -57,11 +57,11 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_or_create_huddle,
|
get_or_create_huddle,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user
|
from zerver.models.users import get_system_bot, get_user
|
||||||
from zerver.views.message_send import InvalidMirrorInputError
|
from zerver.views.message_send import InvalidMirrorInputError
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ from zerver.actions.streams import do_change_stream_permission
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import timeout_mock
|
from zerver.lib.test_helpers import timeout_mock
|
||||||
from zerver.lib.timeout import TimeoutExpiredError
|
from zerver.lib.timeout import TimeoutExpiredError
|
||||||
from zerver.models import Message, UserMessage, get_client, get_realm, get_stream
|
from zerver.models import Message, UserMessage, get_client, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TopicHistoryTest(ZulipTestCase):
|
class TopicHistoryTest(ZulipTestCase):
|
||||||
|
|
|
@ -11,7 +11,7 @@ from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import HostRequestMock
|
from zerver.lib.test_helpers import HostRequestMock
|
||||||
from zerver.lib.utils import assert_is_not_none
|
from zerver.lib.utils import assert_is_not_none
|
||||||
from zerver.middleware import LogRequests, is_slow_query, write_log_line
|
from zerver.middleware import LogRequests, is_slow_query, write_log_line
|
||||||
from zerver.models import get_realm
|
from zerver.models.realms import get_realm
|
||||||
from zilencer.models import RemoteZulipServer
|
from zilencer.models import RemoteZulipServer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ from zerver.actions.message_send import create_mirror_user_if_needed
|
||||||
from zerver.lib.create_user import create_user_profile
|
from zerver.lib.create_user import create_user_profile
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
from zerver.lib.test_helpers import reset_email_visibility_to_everyone_in_zulip_realm
|
||||||
from zerver.models import UserProfile, get_client, get_realm
|
from zerver.models import UserProfile, get_client
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
from zerver.views.message_send import InvalidMirrorInputError, create_mirrored_message_users
|
from zerver.views.message_send import InvalidMirrorInputError, create_mirrored_message_users
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ from zerver.actions.create_user import notify_new_user
|
||||||
from zerver.actions.user_settings import do_change_user_setting
|
from zerver.actions.user_settings import do_change_user_setting
|
||||||
from zerver.lib.initial_password import initial_password
|
from zerver.lib.initial_password import initial_password
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Message, Realm, Recipient, Stream, UserProfile, get_realm
|
from zerver.models import Message, Realm, Recipient, Stream, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.signals import JUST_CREATED_THRESHOLD, get_device_browser, get_device_os
|
from zerver.signals import JUST_CREATED_THRESHOLD, get_device_browser, get_device_os
|
||||||
|
|
||||||
if sys.version_info < (3, 9): # nocoverage
|
if sys.version_info < (3, 9): # nocoverage
|
||||||
|
|
|
@ -12,7 +12,8 @@ from zerver.lib.outgoing_webhook import get_service_interface_class, process_suc
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp
|
from zerver.lib.timestamp import datetime_to_timestamp
|
||||||
from zerver.lib.topic import TOPIC_NAME
|
from zerver.lib.topic import TOPIC_NAME
|
||||||
from zerver.models import SLACK_INTERFACE, Message, NotificationTriggers, get_realm, get_stream
|
from zerver.models import SLACK_INTERFACE, Message, NotificationTriggers, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
from zerver.openapi.openapi import validate_against_openapi_schema
|
from zerver.openapi.openapi import validate_against_openapi_schema
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.topic import TOPIC_NAME
|
from zerver.lib.topic import TOPIC_NAME
|
||||||
from zerver.lib.url_encoding import near_message_url
|
from zerver.lib.url_encoding import near_message_url
|
||||||
from zerver.lib.users import add_service
|
from zerver.lib.users import add_service
|
||||||
from zerver.models import Recipient, Service, UserProfile, get_realm, get_stream
|
from zerver.models import Recipient, Service, UserProfile, get_stream
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class ResponseMock:
|
class ResponseMock:
|
||||||
|
|
|
@ -18,8 +18,8 @@ from zerver.models import (
|
||||||
UserActivityInterval,
|
UserActivityInterval,
|
||||||
UserPresence,
|
UserPresence,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TestClientModel(ZulipTestCase):
|
class TestClientModel(ZulipTestCase):
|
||||||
|
|
|
@ -91,9 +91,9 @@ from zerver.models import (
|
||||||
UserProfile,
|
UserProfile,
|
||||||
UserTopic,
|
UserTopic,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zilencer.models import RemoteZulipServerAuditLog
|
from zilencer.models import RemoteZulipServerAuditLog
|
||||||
from zilencer.views import DevicesToCleanUpDict
|
from zilencer.views import DevicesToCleanUpDict
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ from zerver.models import (
|
||||||
UserActivity,
|
UserActivity,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.tornado.event_queue import build_offline_notification
|
from zerver.tornado.event_queue import build_offline_notification
|
||||||
from zerver.worker import queue_processors
|
from zerver.worker import queue_processors
|
||||||
from zerver.worker.queue_processors import (
|
from zerver.worker.queue_processors import (
|
||||||
|
|
|
@ -12,7 +12,8 @@ from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.lib.message import extract_message_dict
|
from zerver.lib.message import extract_message_dict
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import zulip_reaction_info
|
from zerver.lib.test_helpers import zulip_reaction_info
|
||||||
from zerver.models import Message, Reaction, RealmEmoji, UserMessage, get_realm
|
from zerver.models import Message, Reaction, RealmEmoji, UserMessage
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||||
|
|
|
@ -53,10 +53,10 @@ from zerver.models import (
|
||||||
UserGroupMembership,
|
UserGroupMembership,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
from zerver.models.users import get_system_bot, get_user_profile_by_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ from zerver.actions.users import do_change_user_role
|
||||||
from zerver.lib.domains import validate_domain
|
from zerver.lib.domains import validate_domain
|
||||||
from zerver.lib.email_validation import email_allowed_for_realm
|
from zerver.lib.email_validation import email_allowed_for_realm
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import DomainNotAllowedForRealmError, RealmDomain, UserProfile, get_realm
|
from zerver.models import RealmDomain, UserProfile
|
||||||
|
from zerver.models.realms import DomainNotAllowedForRealmError, get_realm
|
||||||
|
|
||||||
|
|
||||||
class RealmDomainTest(ZulipTestCase):
|
class RealmDomainTest(ZulipTestCase):
|
||||||
|
|
|
@ -9,7 +9,8 @@ from zerver.lib.exceptions import JsonableError
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import get_test_image_file
|
from zerver.lib.test_helpers import get_test_image_file
|
||||||
from zerver.lib.upload.base import BadImageError
|
from zerver.lib.upload.base import BadImageError
|
||||||
from zerver.models import Realm, RealmEmoji, UserProfile, get_realm
|
from zerver.models import Realm, RealmEmoji, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class RealmEmojiTest(ZulipTestCase):
|
class RealmEmojiTest(ZulipTestCase):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from zerver.actions.realm_playgrounds import check_add_realm_playground
|
from zerver.actions.realm_playgrounds import check_add_realm_playground
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import RealmPlayground, get_realm
|
from zerver.models import RealmPlayground
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class RealmPlaygroundTests(ZulipTestCase):
|
class RealmPlaygroundTests(ZulipTestCase):
|
||||||
|
|
|
@ -38,9 +38,9 @@ from zerver.models import (
|
||||||
SubMessage,
|
SubMessage,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
get_client,
|
get_client,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
|
|
||||||
# Class with helper functions useful for testing archiving of reactions:
|
# Class with helper functions useful for testing archiving of reactions:
|
||||||
|
|
|
@ -28,7 +28,8 @@ from zerver.data_import.user_handler import UserHandler
|
||||||
from zerver.lib.emoji import name_to_codepoint
|
from zerver.lib.emoji import name_to_codepoint
|
||||||
from zerver.lib.import_realm import do_import_realm
|
from zerver.lib.import_realm import do_import_realm
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm
|
from zerver.models import Message, Reaction, Recipient, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_user
|
from zerver.models.users import get_user
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ from typing_extensions import override
|
||||||
from zerver.actions.user_settings import do_change_full_name
|
from zerver.actions.user_settings import do_change_full_name
|
||||||
from zerver.lib.scim import ZulipSCIMUser
|
from zerver.lib.scim import ZulipSCIMUser
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import UserProfile, get_realm
|
from zerver.models import UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||||
|
|
|
@ -15,7 +15,8 @@ from zerver.lib.bot_storage import StateError
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import mock_queue_publish
|
from zerver.lib.test_helpers import mock_queue_publish
|
||||||
from zerver.lib.validator import check_string
|
from zerver.lib.validator import check_string
|
||||||
from zerver.models import NotificationTriggers, Recipient, UserProfile, get_realm
|
from zerver.models import NotificationTriggers, Recipient, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
BOT_TYPE_TO_QUEUE_NAME = {
|
BOT_TYPE_TO_QUEUE_NAME = {
|
||||||
UserProfile.OUTGOING_WEBHOOK_BOT: "outgoing_webhooks",
|
UserProfile.OUTGOING_WEBHOOK_BOT: "outgoing_webhooks",
|
||||||
|
|
|
@ -18,7 +18,8 @@ from zerver.lib.sessions import (
|
||||||
user_sessions,
|
user_sessions,
|
||||||
)
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.models import Realm, UserProfile, get_realm
|
from zerver.models import Realm, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class TestSessions(ZulipTestCase):
|
class TestSessions(ZulipTestCase):
|
||||||
|
|
|
@ -76,9 +76,9 @@ from zerver.models import (
|
||||||
Subscription,
|
Subscription,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
|
from zerver.models.users import get_system_bot, get_user, get_user_by_delivery_email
|
||||||
from zerver.views.auth import redirect_and_log_into_subdomain, start_two_factor_auth
|
from zerver.views.auth import redirect_and_log_into_subdomain, start_two_factor_auth
|
||||||
from zerver.views.development.registration import confirmation_key
|
from zerver.views.development.registration import confirmation_key
|
||||||
|
|
|
@ -48,7 +48,8 @@ from zerver.lib.import_realm import do_import_realm
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import read_test_image_file
|
from zerver.lib.test_helpers import read_test_image_file
|
||||||
from zerver.lib.topic import EXPORT_TOPIC_NAME
|
from zerver.lib.topic import EXPORT_TOPIC_NAME
|
||||||
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile, get_realm
|
from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
def remove_folder(path: str) -> None:
|
def remove_folder(path: str) -> None:
|
||||||
|
|
|
@ -27,9 +27,9 @@ from zerver.models import (
|
||||||
UserActivity,
|
UserActivity,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
logger_string = "zulip.soft_deactivation"
|
logger_string = "zulip.soft_deactivation"
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,11 @@ from zerver.models import (
|
||||||
UserMessage,
|
UserMessage,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_default_stream_groups,
|
get_default_stream_groups,
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
validate_attachment_request,
|
validate_attachment_request,
|
||||||
validate_attachment_request_for_spectator_access,
|
validate_attachment_request_for_spectator_access,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import active_non_guest_user_ids, get_user, get_user_profile_by_id_in_realm
|
from zerver.models.users import active_non_guest_user_ids, get_user, get_user_profile_by_id_in_realm
|
||||||
from zerver.views.streams import compose_views
|
from zerver.views.streams import compose_views
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ from zerver.models import (
|
||||||
Realm,
|
Realm,
|
||||||
RealmDomain,
|
RealmDomain,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
get_realm,
|
|
||||||
validate_attachment_request,
|
validate_attachment_request,
|
||||||
)
|
)
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot, get_user_by_delivery_email
|
from zerver.models.users import get_system_bot, get_user_by_delivery_email
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ from zerver.lib.upload import (
|
||||||
)
|
)
|
||||||
from zerver.lib.upload.base import DEFAULT_EMOJI_SIZE, MEDIUM_AVATAR_SIZE, resize_avatar
|
from zerver.lib.upload.base import DEFAULT_EMOJI_SIZE, MEDIUM_AVATAR_SIZE, resize_avatar
|
||||||
from zerver.lib.upload.local import write_local_file
|
from zerver.lib.upload.local import write_local_file
|
||||||
from zerver.models import Attachment, RealmEmoji, get_realm
|
from zerver.models import Attachment, RealmEmoji
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ from zerver.lib.upload.base import (
|
||||||
resize_avatar,
|
resize_avatar,
|
||||||
)
|
)
|
||||||
from zerver.lib.upload.s3 import S3UploadBackend
|
from zerver.lib.upload.s3 import S3UploadBackend
|
||||||
from zerver.models import Attachment, RealmEmoji, UserProfile, get_realm
|
from zerver.models import Attachment, RealmEmoji, UserProfile
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
from zerver.models.users import get_system_bot
|
from zerver.models.users import get_system_bot
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,15 +32,9 @@ from zerver.lib.user_groups import (
|
||||||
is_user_in_group,
|
is_user_in_group,
|
||||||
user_groups_in_realm_serialized,
|
user_groups_in_realm_serialized,
|
||||||
)
|
)
|
||||||
from zerver.models import (
|
from zerver.models import GroupGroupMembership, Realm, UserGroup, UserGroupMembership, UserProfile
|
||||||
GroupGroupMembership,
|
|
||||||
Realm,
|
|
||||||
UserGroup,
|
|
||||||
UserGroupMembership,
|
|
||||||
UserProfile,
|
|
||||||
get_realm,
|
|
||||||
)
|
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import get_realm
|
||||||
|
|
||||||
|
|
||||||
class UserGroupTestCase(ZulipTestCase):
|
class UserGroupTestCase(ZulipTestCase):
|
||||||
|
|
|
@ -59,7 +59,6 @@ from zerver.lib.users import (
|
||||||
from zerver.lib.utils import assert_is_not_none
|
from zerver.lib.utils import assert_is_not_none
|
||||||
from zerver.models import (
|
from zerver.models import (
|
||||||
CustomProfileField,
|
CustomProfileField,
|
||||||
InvalidFakeEmailDomainError,
|
|
||||||
Message,
|
Message,
|
||||||
OnboardingStep,
|
OnboardingStep,
|
||||||
PreregistrationUser,
|
PreregistrationUser,
|
||||||
|
@ -76,11 +75,10 @@ from zerver.models import (
|
||||||
check_valid_user_ids,
|
check_valid_user_ids,
|
||||||
filter_to_valid_prereg_users,
|
filter_to_valid_prereg_users,
|
||||||
get_client,
|
get_client,
|
||||||
get_fake_email_domain,
|
|
||||||
get_realm,
|
|
||||||
get_stream,
|
get_stream,
|
||||||
)
|
)
|
||||||
from zerver.models.groups import SystemGroups
|
from zerver.models.groups import SystemGroups
|
||||||
|
from zerver.models.realms import InvalidFakeEmailDomainError, get_fake_email_domain, get_realm
|
||||||
from zerver.models.users import (
|
from zerver.models.users import (
|
||||||
get_source_profile,
|
get_source_profile,
|
||||||
get_system_bot,
|
get_system_bot,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue