models: Extract zerver.models.users.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-12-14 16:16:00 -08:00 committed by Tim Abbott
parent 37a9c4501f
commit 45bb8d2580
114 changed files with 1260 additions and 1273 deletions

View File

@ -79,9 +79,8 @@ from zerver.models import (
UserGroup, UserGroup,
UserProfile, UserProfile,
get_client, get_client,
get_user,
is_cross_realm_bot_email,
) )
from zerver.models.users import get_user, is_cross_realm_bot_email
from zilencer.models import ( from zilencer.models import (
RemoteInstallationCount, RemoteInstallationCount,
RemotePushDeviceToken, RemotePushDeviceToken,

View File

@ -42,8 +42,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_org_type_display_name, get_org_type_display_name,
get_realm, get_realm,
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
if settings.ZILENCER_ENABLED: if settings.ZILENCER_ENABLED:

View File

@ -11,7 +11,8 @@ from analytics.views.activity_common import (
make_table, make_table,
) )
from zerver.decorator import require_server_admin from zerver.decorator import require_server_admin
from zerver.models import UserActivity, UserProfile, get_user_profile_by_id from zerver.models import UserActivity, UserProfile
from zerver.models.users import get_user_profile_by_id
if settings.BILLING_ENABLED: if settings.BILLING_ENABLED:
pass pass

View File

@ -7,7 +7,8 @@ from corporate.lib.stripe import LicenseLimitError, get_latest_seat_count, get_s
from corporate.models import get_current_plan_by_realm from corporate.models import get_current_plan_by_realm
from zerver.actions.create_user import send_message_to_signup_notification_stream from zerver.actions.create_user import send_message_to_signup_notification_stream
from zerver.lib.exceptions import InvitationError from zerver.lib.exceptions import InvitationError
from zerver.models import Realm, UserProfile, get_system_bot from zerver.models import Realm, UserProfile
from zerver.models.users import get_system_bot
def generate_licenses_low_warning_message_if_required(realm: Realm) -> Optional[str]: def generate_licenses_low_warning_message_if_required(realm: Realm) -> Optional[str]:

View File

@ -50,14 +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 ( from zerver.models import Realm, RealmAuditLog, UserProfile, get_org_type_display_name, get_realm
Realm, from zerver.models.users import get_system_bot
RealmAuditLog,
UserProfile,
get_org_type_display_name,
get_realm,
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 (
RemoteRealm, RemoteRealm,

View File

@ -13,7 +13,7 @@ from corporate.lib.stripe import (
UpgradeWithExistingPlanError, UpgradeWithExistingPlanError,
) )
from corporate.models import Customer, CustomerPlan, Event, PaymentIntent, Session from corporate.models import Customer, CustomerPlan, Event, PaymentIntent, Session
from zerver.models import get_active_user_profile_by_id_in_realm from zerver.models.users import get_active_user_profile_by_id_in_realm
billing_logger = logging.getLogger("corporate.stripe") billing_logger = logging.getLogger("corporate.stripe")

View File

@ -102,15 +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 ( from zerver.models import Message, Realm, RealmAuditLog, Recipient, UserProfile, get_realm
Message, from zerver.models.users import get_system_bot
Realm,
RealmAuditLog,
Recipient,
UserProfile,
get_realm,
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 (
RemoteRealm, RemoteRealm,

View File

@ -365,7 +365,7 @@ You can look at the [full list of fields][models-py] in the Zulip user
model; search for `class UserProfile`, but the above should cover all model; search for `class UserProfile`, but the above should cover all
the fields that would be useful to sync from your LDAP databases. the fields that would be useful to sync from your LDAP databases.
[models-py]: https://github.com/zulip/zulip/blob/main/zerver/models/__init__.py [models-py]: https://github.com/zulip/zulip/blob/main/zerver/models/users.py
[django-auth-booleans]: https://django-auth-ldap.readthedocs.io/en/latest/users.html#easy-attributes [django-auth-booleans]: https://django-auth-ldap.readthedocs.io/en/latest/users.html#easy-attributes
### Multiple LDAP searches ### Multiple LDAP searches

View File

@ -37,7 +37,7 @@ On a high level the typing indicators system works like this:
Note that there is a user-level privacy setting to disable sending Note that there is a user-level privacy setting to disable sending
typing notifications that a client should check when implementing typing notifications that a client should check when implementing
the "writing user" protocol below. See `send_private_typing_notifications` the "writing user" protocol below. See `send_private_typing_notifications`
in the `UserBaseSettings` model in `zerver/models/__init__.py` and in the in the `UserBaseSettings` model in `zerver/models/users.py` and in the
`user_settings` object in the `POST /register` response. `user_settings` object in the `POST /register` response.
## Writing user ## Writing user

View File

@ -66,7 +66,8 @@ django.setup()
from django.conf import settings from django.conf import settings
from zerver.models import get_realm, get_system_bot from zerver.models import get_realm
from zerver.models.users import get_system_bot
states = { states = {
"OK": 0, "OK": 0,

View File

@ -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, get_user_by_delivery_email from zerver.models import Message, UserProfile, get_realm
from zerver.models.users import get_user_by_delivery_email
def create_integration_bot(integration: Integration, bot_name: Optional[str] = None) -> UserProfile: def create_integration_bot(integration: Integration, bot_name: Optional[str] = None) -> UserProfile:

View File

@ -36,7 +36,8 @@ 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, get_user from zerver.models import get_realm
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 (
test_invalid_api_key, test_invalid_api_key,

View File

@ -10,7 +10,7 @@ const bot_data = zrequire("bot_data");
const people = zrequire("people"); const people = zrequire("people");
// Bot types and service bot types can be found // Bot types and service bot types can be found
// in zerver/models/__init__.py - UserProfile Class or // in zerver/models/users.py - UserProfile Class or
// zever/openapi/zulip.yaml // zever/openapi/zulip.yaml
const me = { const me = {

View File

@ -6,7 +6,8 @@ from django.utils.timezone import now as timezone_now
from zerver.actions.create_user import created_bot_event from zerver.actions.create_user import created_bot_event
from zerver.actions.streams import bulk_remove_subscriptions from zerver.actions.streams import bulk_remove_subscriptions
from zerver.lib.streams import get_subscribed_private_streams_for_user from zerver.lib.streams import get_subscribed_private_streams_for_user
from zerver.models import RealmAuditLog, Stream, UserProfile, active_user_ids, bot_owner_user_ids from zerver.models import RealmAuditLog, Stream, UserProfile
from zerver.models.users import active_user_ids, bot_owner_user_ids
from zerver.tornado.django_api import send_event_on_commit from zerver.tornado.django_api import send_event_on_commit

View File

@ -33,8 +33,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_org_type_display_name, get_org_type_display_name,
get_realm, get_realm,
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
if settings.CORPORATE_ENABLED: if settings.CORPORATE_ENABLED:

View File

@ -49,10 +49,8 @@ from zerver.models import (
UserGroupMembership, UserGroupMembership,
UserMessage, UserMessage,
UserProfile, UserProfile,
active_user_ids,
bot_owner_user_ids,
get_system_bot,
) )
from zerver.models.users import active_user_ids, bot_owner_user_ids, get_system_bot
from zerver.tornado.django_api import send_event_on_commit from zerver.tornado.django_api import send_event_on_commit
if settings.BILLING_ENABLED: if settings.BILLING_ENABLED:

View File

@ -14,9 +14,9 @@ from zerver.models import (
CustomProfileFieldValue, CustomProfileFieldValue,
Realm, Realm,
UserProfile, UserProfile,
active_user_ids,
custom_profile_fields_for_realm, custom_profile_fields_for_realm,
) )
from zerver.models.users import active_user_ids
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -13,9 +13,9 @@ from zerver.models import (
DefaultStreamGroup, DefaultStreamGroup,
Realm, Realm,
Stream, Stream,
active_non_guest_user_ids,
get_default_stream_groups, get_default_stream_groups,
) )
from zerver.models.users import active_non_guest_user_ids
from zerver.tornado.django_api import send_event_on_commit from zerver.tornado.django_api import send_event_on_commit

View File

@ -77,8 +77,8 @@ from zerver.models import (
UserProfile, UserProfile,
UserTopic, UserTopic,
get_stream_by_id_in_realm, get_stream_by_id_in_realm,
get_system_bot,
) )
from zerver.models.users import get_system_bot
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -107,11 +107,9 @@ from zerver.models import (
get_huddle_user_ids, get_huddle_user_ids,
get_stream, get_stream,
get_stream_by_id_in_realm, get_stream_by_id_in_realm,
get_system_bot,
get_user_by_delivery_email,
is_cross_realm_bot_email,
query_for_ids, query_for_ids,
) )
from zerver.models.users import get_system_bot, get_user_by_delivery_email, is_cross_realm_bot_email
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -12,7 +12,8 @@ from zerver.lib.presence import (
from zerver.lib.queue import queue_json_publish from zerver.lib.queue import queue_json_publish
from zerver.lib.timestamp import datetime_to_timestamp from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.users import get_user_ids_who_can_access_user from zerver.lib.users import get_user_ids_who_can_access_user
from zerver.models import Client, UserPresence, UserProfile, active_user_ids, get_client from zerver.models import Client, UserPresence, UserProfile, get_client
from zerver.models.users import active_user_ids
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -10,9 +10,9 @@ from zerver.models import (
RealmDomain, RealmDomain,
RealmDomainDict, RealmDomainDict,
UserProfile, UserProfile,
active_user_ids,
get_realm_domains, get_realm_domains,
) )
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

View File

@ -16,9 +16,9 @@ from zerver.models import (
RealmAuditLog, RealmAuditLog,
RealmEmoji, RealmEmoji,
UserProfile, UserProfile,
active_user_ids,
get_all_custom_emoji_for_realm, get_all_custom_emoji_for_realm,
) )
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

View File

@ -4,7 +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.lib.realm_icon import realm_icon_url from zerver.lib.realm_icon import realm_icon_url
from zerver.models import Realm, RealmAuditLog, UserProfile, active_user_ids from zerver.models import Realm, RealmAuditLog, UserProfile
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

View File

@ -12,10 +12,10 @@ from zerver.models import (
RealmAuditLog, RealmAuditLog,
RealmFilter, RealmFilter,
UserProfile, UserProfile,
active_user_ids,
flush_linkifiers, flush_linkifiers,
linkifiers_for_realm, linkifiers_for_realm,
) )
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

View File

@ -4,7 +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.lib.realm_logo import get_realm_logo_data from zerver.lib.realm_logo import get_realm_logo_data
from zerver.models import Realm, RealmAuditLog, UserProfile, active_user_ids from zerver.models import Realm, RealmAuditLog, UserProfile
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

View File

@ -6,14 +6,8 @@ from django.utils.timezone import now as timezone_now
from zerver.lib.exceptions import ValidationFailureError from zerver.lib.exceptions import ValidationFailureError
from zerver.lib.types import RealmPlaygroundDict from zerver.lib.types import RealmPlaygroundDict
from zerver.models import ( from zerver.models import Realm, RealmAuditLog, RealmPlayground, UserProfile, get_realm_playgrounds
Realm, from zerver.models.users import active_user_ids
RealmAuditLog,
RealmPlayground,
UserProfile,
active_user_ids,
get_realm_playgrounds,
)
from zerver.tornado.django_api import send_event_on_commit from zerver.tornado.django_api import send_event_on_commit

View File

@ -34,9 +34,9 @@ from zerver.models import (
SystemGroups, SystemGroups,
UserGroup, UserGroup,
UserProfile, UserProfile,
active_user_ids,
get_realm, get_realm,
) )
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
if settings.BILLING_ENABLED: if settings.BILLING_ENABLED:

View File

@ -27,8 +27,8 @@ from zerver.models import (
Subscription, Subscription,
UserProfile, UserProfile,
get_recipient_ids, get_recipient_ids,
get_system_bot,
) )
from zerver.models.users import get_system_bot
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event
SCHEDULED_MESSAGE_LATE_CUTOFF_MINUTES = 10 SCHEDULED_MESSAGE_LATE_CUTOFF_MINUTES = 10

View File

@ -67,10 +67,8 @@ from zerver.models import (
SystemGroups, SystemGroups,
UserGroup, UserGroup,
UserProfile, UserProfile,
active_non_guest_user_ids,
active_user_ids,
get_system_bot,
) )
from zerver.models.users import active_non_guest_user_ids, active_user_ids, get_system_bot
from zerver.tornado.django_api import send_event, send_event_on_commit from zerver.tornado.django_api import send_event, send_event_on_commit

View File

@ -5,7 +5,8 @@ from django.utils.translation import gettext as _
from zerver.lib.exceptions import JsonableError from zerver.lib.exceptions import JsonableError
from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id
from zerver.models import Realm, Stream, UserProfile, get_user_by_id_in_realm_including_cross_realm from zerver.models import Realm, Stream, UserProfile
from zerver.models.users import get_user_by_id_in_realm_including_cross_realm
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -19,8 +19,8 @@ from zerver.models import (
UserGroup, UserGroup,
UserGroupMembership, UserGroupMembership,
UserProfile, UserProfile,
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

View File

@ -39,10 +39,9 @@ from zerver.models import (
ScheduledMessageNotificationEmail, ScheduledMessageNotificationEmail,
UserPresence, UserPresence,
UserProfile, UserProfile,
bot_owner_user_ids,
get_client, get_client,
get_user_profile_by_id,
) )
from zerver.models.users import bot_owner_user_ids, get_user_profile_by_id
from zerver.tornado.django_api import send_event, send_event_on_commit from zerver.tornado.django_api import send_event, send_event_on_commit

View File

@ -41,12 +41,14 @@ from zerver.models import (
Subscription, Subscription,
UserGroupMembership, UserGroupMembership,
UserProfile, UserProfile,
get_bot_services,
get_fake_email_domain,
)
from zerver.models.users import (
active_non_guest_user_ids, active_non_guest_user_ids,
active_user_ids, active_user_ids,
bot_owner_user_ids, bot_owner_user_ids,
get_bot_dicts_in_realm, get_bot_dicts_in_realm,
get_bot_services,
get_fake_email_domain,
get_user_profile_by_id, get_user_profile_by_id,
) )
from zerver.tornado.django_api import send_event, send_event_on_commit from zerver.tornado.django_api import send_event, send_event_on_commit

View File

@ -61,7 +61,8 @@ from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.lib.users import is_2fa_verified from zerver.lib.users import is_2fa_verified
from zerver.lib.utils import has_api_key_format from zerver.lib.utils import has_api_key_format
from zerver.lib.webhooks.common import notify_bot_owner_about_invalid_json from zerver.lib.webhooks.common import notify_bot_owner_about_invalid_json
from zerver.models import UserProfile, get_client, get_user_profile_by_api_key from zerver.models import UserProfile, get_client
from zerver.models.users import get_user_profile_by_api_key
if TYPE_CHECKING: if TYPE_CHECKING:
from django.http.request import _ImmutableQueryDict from django.http.request import _ImmutableQueryDict

View File

@ -42,9 +42,8 @@ from zerver.models import (
Realm, Realm,
UserProfile, UserProfile,
get_realm, get_realm,
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
from zproject.backends import check_password_strength, email_auth_enabled, email_belongs_to_ldap from zproject.backends import check_password_strength, email_auth_enabled, email_belongs_to_ldap
if settings.BILLING_ENABLED: if settings.BILLING_ENABLED:

View File

@ -4,10 +4,8 @@ from django.utils.translation import gettext as _
from zerver.lib.exceptions import JsonableError from zerver.lib.exceptions import JsonableError
from zerver.lib.string_validation import check_stream_topic from zerver.lib.string_validation import check_stream_topic
from zerver.models import ( from zerver.models import Realm, Stream, UserProfile
Realm, from zerver.models.users import (
Stream,
UserProfile,
get_user_by_id_in_realm_including_cross_realm, get_user_by_id_in_realm_including_cross_realm,
get_user_including_cross_realm, get_user_including_cross_realm,
) )

View File

@ -20,7 +20,8 @@ from zerver.lib.bot_storage import (
) )
from zerver.lib.integrations import EMBEDDED_BOTS from zerver.lib.integrations import EMBEDDED_BOTS
from zerver.lib.topic import get_topic_from_message_info from zerver.lib.topic import get_topic_from_message_info
from zerver.models import UserProfile, get_active_user from zerver.models import UserProfile
from zerver.models.users import get_active_user
def get_bot_handler(service_name: str) -> Any: def get_bot_handler(service_name: str) -> Any:

View File

@ -518,7 +518,7 @@ def bot_dicts_in_realm_cache_key(realm_id: int) -> str:
def delete_user_profile_caches(user_profiles: Iterable["UserProfile"], realm: "Realm") -> None: def delete_user_profile_caches(user_profiles: Iterable["UserProfile"], realm: "Realm") -> None:
# Imported here to avoid cyclic dependency. # Imported here to avoid cyclic dependency.
from zerver.lib.users import get_all_api_keys from zerver.lib.users import get_all_api_keys
from zerver.models import is_cross_realm_bot_email from zerver.models.users import is_cross_realm_bot_email
keys = [] keys = []
for user_profile in user_profiles: for user_profile in user_profiles:
@ -554,7 +554,7 @@ def changed(update_fields: Optional[Sequence[str]], fields: List[str]) -> bool:
return any(f in update_fields_set for f in fields) return any(f in update_fields_set for f in fields)
# Called by models/__init__.py to flush the user_profile cache whenever we save # Called by models/users.py to flush the user_profile cache whenever we save
# a user_profile object # a user_profile object
def flush_user_profile( def flush_user_profile(
*, *,

View File

@ -38,9 +38,8 @@ from zerver.models import (
get_client, get_client,
get_display_recipient, get_display_recipient,
get_stream_by_id_in_realm, get_stream_by_id_in_realm,
get_system_bot,
get_user_profile_by_id,
) )
from zerver.models.users import get_system_bot, get_user_profile_by_id
from zproject.backends import is_user_active from zproject.backends import is_user_active
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -45,8 +45,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_context_for_message, get_context_for_message,
get_display_recipient, get_display_recipient,
get_user_profile_by_id,
) )
from zerver.models.users import get_user_profile_by_id
if sys.version_info < (3, 9): # nocoverage if sys.version_info < (3, 9): # nocoverage
from backports import zoneinfo from backports import zoneinfo

View File

@ -14,9 +14,8 @@ from zerver.models import (
EmailContainsPlusError, EmailContainsPlusError,
Realm, Realm,
RealmDomain, RealmDomain,
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
def validate_disposable(email: str) -> None: def validate_disposable(email: str) -> None:

View File

@ -453,7 +453,7 @@ def fetch_initial_state_data(
assert spectator_requested_language is not None assert spectator_requested_language is not None
# When UserProfile=None, we want to serve the values for various # When UserProfile=None, we want to serve the values for various
# settings as the defaults. Instead of copying the default values # settings as the defaults. Instead of copying the default values
# from models/__init__.py here, we access these default values from a # from models/users.py here, we access these default values from a
# temporary UserProfile object that will not be saved to the database. # temporary UserProfile object that will not be saved to the database.
# #
# We also can set various fields to avoid duplicating code # We also can set various fields to avoid duplicating code

View File

@ -70,9 +70,8 @@ from zerver.models import (
UserStatus, UserStatus,
UserTopic, UserTopic,
get_realm, get_realm,
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:
Record: TypeAlias = Dict[str, Any] Record: TypeAlias = Dict[str, Any]

View File

@ -79,9 +79,8 @@ from zerver.models import (
UserTopic, UserTopic,
get_huddle_hash, get_huddle_hash,
get_realm, get_realm,
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 = [
("zerver_realmauthenticationmethod", RealmAuthenticationMethod, "realmauthenticationmethod"), ("zerver_realmauthenticationmethod", RealmAuthenticationMethod, "realmauthenticationmethod"),

View File

@ -83,6 +83,8 @@ from zerver.models import (
UserMessage, UserMessage,
UserProfile, UserProfile,
get_active_streams, get_active_streams,
)
from zerver.models.users import (
get_user_by_id_in_realm_including_cross_realm, get_user_by_id_in_realm_including_cross_realm,
get_user_including_cross_realm, get_user_including_cross_realm,
) )

View File

@ -15,7 +15,8 @@ from zerver.actions.message_send import (
from zerver.actions.reactions import do_add_reaction from zerver.actions.reactions import do_add_reaction
from zerver.lib.emoji import get_emoji_data from zerver.lib.emoji import get_emoji_data
from zerver.lib.message import SendMessageRequest from zerver.lib.message import SendMessageRequest
from zerver.models import Message, Realm, UserProfile, get_system_bot from zerver.models import Message, Realm, UserProfile
from zerver.models.users import get_system_bot
def missing_any_realm_internal_bots() -> bool: def missing_any_realm_internal_bots() -> bool:

View File

@ -26,8 +26,8 @@ from zerver.models import (
Service, Service,
UserProfile, UserProfile,
get_client, get_client,
get_user_profile_by_id,
) )
from zerver.models.users import get_user_profile_by_id
class OutgoingWebhookServiceInterface(metaclass=abc.ABCMeta): class OutgoingWebhookServiceInterface(metaclass=abc.ABCMeta):

View File

@ -66,8 +66,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_display_recipient, get_display_recipient,
get_fake_email_domain, get_fake_email_domain,
get_user_profile_by_id,
) )
from zerver.models.users import get_user_profile_by_id
if TYPE_CHECKING: if TYPE_CHECKING:
import aioapns import aioapns

View File

@ -3,7 +3,8 @@ from typing import Dict, Optional, Sequence
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from zerver.models import Recipient, UserProfile, get_or_create_huddle, is_cross_realm_bot_email from zerver.models import Recipient, UserProfile, get_or_create_huddle
from zerver.models.users import is_cross_realm_bot_email
def get_recipient_from_user_profiles( def get_recipient_from_user_profiles(

View File

@ -29,7 +29,8 @@ from django.utils.translation import override as override_language
from confirmation.models import generate_key from confirmation.models import generate_key
from zerver.lib.logging_util import log_to_file from zerver.lib.logging_util import log_to_file
from zerver.models import EMAIL_TYPES, Realm, ScheduledEmail, UserProfile, get_user_profile_by_id from zerver.models import EMAIL_TYPES, Realm, ScheduledEmail, UserProfile
from zerver.models.users import get_user_profile_by_id
from zproject.email_backends import EmailLogBackEnd, get_forward_address from zproject.email_backends import EmailLogBackEnd, get_forward_address
if settings.ZILENCER_ENABLED: if settings.ZILENCER_ENABLED:

View File

@ -12,8 +12,8 @@ from zerver.models import (
RealmUserDefault, RealmUserDefault,
UserProfile, UserProfile,
get_client, get_client,
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

View File

@ -10,7 +10,8 @@ from django.contrib.sessions.models import Session
from django.utils.timezone import now as timezone_now from django.utils.timezone import now as timezone_now
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.models import Realm, UserProfile, get_user_profile_by_id from zerver.models import Realm, UserProfile
from zerver.models.users import get_user_profile_by_id
class SessionEngine(Protocol): class SessionEngine(Protocol):

View File

@ -31,14 +31,12 @@ from zerver.models import (
SystemGroups, SystemGroups,
UserGroup, UserGroup,
UserProfile, UserProfile,
active_non_guest_user_ids,
active_user_ids,
bulk_get_streams, bulk_get_streams,
get_realm_stream, get_realm_stream,
get_stream, get_stream,
get_stream_by_id_in_realm, get_stream_by_id_in_realm,
is_cross_realm_bot_email,
) )
from zerver.models.users import active_non_guest_user_ids, active_user_ids, is_cross_realm_bot_email
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -112,10 +112,8 @@ from zerver.models import (
get_realm, get_realm,
get_realm_stream, get_realm_stream,
get_stream, get_stream,
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

View File

@ -10,7 +10,8 @@ from PIL import GifImagePlugin, Image, ImageOps, PngImagePlugin
from PIL.Image import DecompressionBombError from PIL.Image import DecompressionBombError
from zerver.lib.exceptions import ErrorCode, JsonableError from zerver.lib.exceptions import ErrorCode, JsonableError
from zerver.models import Attachment, Realm, UserProfile, is_cross_realm_bot_email from zerver.models import Attachment, Realm, UserProfile
from zerver.models.users import is_cross_realm_bot_email
DEFAULT_AVATAR_SIZE = 100 DEFAULT_AVATAR_SIZE = 100
MEDIUM_AVATAR_SIZE = 500 MEDIUM_AVATAR_SIZE = 500

View File

@ -37,9 +37,11 @@ from zerver.models import (
SystemGroups, SystemGroups,
UserMessage, UserMessage,
UserProfile, UserProfile,
get_fake_email_domain,
)
from zerver.models.users import (
active_non_guest_user_ids, active_non_guest_user_ids,
active_user_ids, active_user_ids,
get_fake_email_domain,
get_realm_user_dicts, get_realm_user_dicts,
get_user, get_user,
get_user_by_id_in_realm_including_cross_realm, get_user_by_id_in_realm_including_cross_realm,

View File

@ -8,7 +8,7 @@ from returns.curry import partial
from typing_extensions import override from typing_extensions import override
from zerver.lib.rate_limiter import RateLimitedUser, client from zerver.lib.rate_limiter import RateLimitedUser, client
from zerver.models import get_user_profile_by_id from zerver.models.users import get_user_profile_by_id
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -16,14 +16,8 @@ from typing_extensions import override
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zerver.lib.soft_deactivation import reactivate_user_if_soft_deactivated from zerver.lib.soft_deactivation import reactivate_user_if_soft_deactivated
from zerver.lib.upload import save_attachment_contents from zerver.lib.upload import save_attachment_contents
from zerver.models import ( from zerver.models import Attachment, Message, Recipient, Stream, UserProfile
Attachment, from zerver.models.users import get_user_by_delivery_email
Message,
Recipient,
Stream,
UserProfile,
get_user_by_delivery_email,
)
def write_attachment(base_path: str, attachment: Attachment) -> None: def write_attachment(base_path: str, attachment: Attachment) -> None:

View File

@ -6,7 +6,8 @@ from typing_extensions import override
from zerver.lib.management import ZulipBaseCommand from zerver.lib.management import ZulipBaseCommand
from zerver.lib.rate_limiter import RateLimitedUser from zerver.lib.rate_limiter import RateLimitedUser
from zerver.models import UserProfile, get_user_profile_by_api_key from zerver.models import UserProfile
from zerver.models.users import get_user_profile_by_api_key
class Command(ZulipBaseCommand): class Command(ZulipBaseCommand):

File diff suppressed because it is too large Load Diff

1077
zerver/models/users.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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, get_user from zerver.models import Client, Message, UserGroup, UserPresence, get_realm
from zerver.models.users import get_user
GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {} GENERATOR_FUNCTIONS: Dict[str, Callable[[], Dict[str, object]]] = {}
REGISTERED_GENERATOR_FUNCTIONS: Set[str] = set() REGISTERED_GENERATOR_FUNCTIONS: Set[str] = set()

View File

@ -22,7 +22,8 @@ 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, get_user from zerver.models import get_realm
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
ZULIP_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) ZULIP_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

View File

@ -110,7 +110,6 @@ from zerver.models import (
CustomProfileField, CustomProfileField,
CustomProfileFieldValue, CustomProfileFieldValue,
MultiuseInvite, MultiuseInvite,
PasswordTooWeakError,
PreregistrationUser, PreregistrationUser,
Realm, Realm,
RealmDomain, RealmDomain,
@ -119,8 +118,8 @@ from zerver.models import (
UserProfile, UserProfile,
clear_supported_auth_backends_cache, clear_supported_auth_backends_cache,
get_realm, get_realm,
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
from zproject.backends import ( from zproject.backends import (

View File

@ -26,9 +26,8 @@ from zerver.models import (
get_bot_services, get_bot_services,
get_realm, get_realm,
get_stream, get_stream,
get_user,
is_cross_realm_bot_email,
) )
from zerver.models.users import get_user, is_cross_realm_bot_email
# A test validator # A test validator

View File

@ -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, get_system_bot, get_user, get_user_profile_by_id from zerver.models import UserProfile, get_realm
from zerver.models.users import get_system_bot, get_user, get_user_profile_by_id
class AppsTest(ZulipTestCase): class AppsTest(ZulipTestCase):

View File

@ -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, get_user from zerver.models import Client, Realm, UserProfile, clear_client_cache, get_realm
from zerver.models.users import get_user
if settings.ZILENCER_ENABLED: if settings.ZILENCER_ENABLED:
from zilencer.models import RemoteZulipServer from zilencer.models import RemoteZulipServer

View File

@ -18,14 +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 ( from zerver.models import EmailChangeStatus, UserProfile, get_realm
EmailChangeStatus, from zerver.models.users import get_user, get_user_by_delivery_email, get_user_profile_by_id
UserProfile,
get_realm,
get_user,
get_user_by_delivery_email,
get_user_profile_by_id,
)
class EmailChangeTestCase(ZulipTestCase): class EmailChangeTestCase(ZulipTestCase):

View File

@ -37,15 +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 ( from zerver.models import Attachment, Recipient, Stream, UserProfile, get_realm, get_stream
Attachment, from zerver.models.users import get_system_bot
Recipient,
Stream,
UserProfile,
get_realm,
get_stream,
get_system_bot,
)
from zerver.worker.queue_processors import MirrorWorker from zerver.worker.queue_processors import MirrorWorker
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -5,13 +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 ( from zerver.models import UserProfile, get_display_recipient, get_realm, get_service_profile
UserProfile, from zerver.models.users import get_user
get_display_recipient,
get_realm,
get_service_profile,
get_user,
)
class TestEmbeddedBotMessaging(ZulipTestCase): class TestEmbeddedBotMessaging(ZulipTestCase):

View File

@ -36,8 +36,8 @@ from zerver.models import (
get_client, get_client,
get_realm, get_realm,
get_stream, get_stream,
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,
clear_client_event_queues_for_testing, clear_client_event_queues_for_testing,

View File

@ -243,8 +243,8 @@ from zerver.models import (
UserTopic, UserTopic,
get_client, get_client,
get_stream, get_stream,
get_user_by_delivery_email,
) )
from zerver.models.users import get_user_by_delivery_email
from zerver.openapi.openapi import validate_against_openapi_schema from zerver.openapi.openapi import validate_against_openapi_schema
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event
from zerver.tornado.event_queue import ( from zerver.tornado.event_queue import (

View File

@ -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, get_user_by_delivery_email from zerver.models import UserProfile, UserStatus, get_realm, get_stream
from zerver.models.users import get_user_by_delivery_email
# Most Zulip tests use ZulipTestCase, which inherits from django.test.TestCase. # Most Zulip tests use ZulipTestCase, which inherits from django.test.TestCase.

View File

@ -32,9 +32,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_realm, get_realm,
get_stream, get_stream,
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
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -89,9 +89,8 @@ from zerver.models import (
get_huddle_hash, get_huddle_hash,
get_realm, get_realm,
get_stream, get_stream,
get_system_bot,
get_user_by_delivery_email,
) )
from zerver.models.users import get_system_bot, get_user_by_delivery_email
def make_datetime(val: float) -> datetime: def make_datetime(val: float) -> datetime:

View File

@ -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, get_user from zerver.models import Message, Stream, get_realm
from zerver.models.users import get_user
class TestIntegrationsDevPanel(ZulipTestCase): class TestIntegrationsDevPanel(ZulipTestCase):

View File

@ -66,8 +66,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_realm, get_realm,
get_stream, get_stream,
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

View File

@ -20,16 +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 ( from zerver.models import Message, Reaction, Realm, Recipient, UserProfile, get_realm, get_stream
Message, from zerver.models.users import get_user_profile_by_email
Reaction,
Realm,
Recipient,
UserProfile,
get_realm,
get_stream,
get_user_profile_by_email,
)
class TestCheckConfig(ZulipTestCase): class TestCheckConfig(ZulipTestCase):

View File

@ -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, get_user from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm
from zerver.models.users import get_user
class MatterMostImporter(ZulipTestCase): class MatterMostImporter(ZulipTestCase):

View File

@ -60,10 +60,9 @@ from zerver.models import (
get_or_create_huddle, get_or_create_huddle,
get_realm, get_realm,
get_stream, get_stream,
get_system_bot,
get_user,
) )
from zerver.models.constants import MAX_TOPIC_NAME_LENGTH from zerver.models.constants import MAX_TOPIC_NAME_LENGTH
from zerver.models.users import get_system_bot, get_user
from zerver.views.message_send import InvalidMirrorInputError from zerver.views.message_send import InvalidMirrorInputError

View File

@ -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, get_user from zerver.models import UserProfile, get_client, get_realm
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

View File

@ -12,14 +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 ( from zerver.models import SLACK_INTERFACE, Message, NotificationTriggers, get_realm, get_stream
SLACK_INTERFACE, from zerver.models.users import get_user
Message,
NotificationTriggers,
get_realm,
get_stream,
get_user,
)
from zerver.openapi.openapi import validate_against_openapi_schema from zerver.openapi.openapi import validate_against_openapi_schema

View File

@ -56,9 +56,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_realm, get_realm,
get_stream, get_stream,
get_system_bot,
get_user_profile_by_id,
) )
from zerver.models.users import get_system_bot, get_user_profile_by_id
class RealmTest(ZulipTestCase): class RealmTest(ZulipTestCase):

View File

@ -40,8 +40,8 @@ from zerver.models import (
get_client, get_client,
get_realm, get_realm,
get_stream, get_stream,
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:
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -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, get_user from zerver.models import Message, Reaction, Recipient, UserProfile, get_realm
from zerver.models.users import get_user
class RocketChatImporter(ZulipTestCase): class RocketChatImporter(ZulipTestCase):

View File

@ -16,8 +16,8 @@ from zerver.models import (
NotificationTriggers, NotificationTriggers,
ScheduledMessageNotificationEmail, ScheduledMessageNotificationEmail,
UserProfile, UserProfile,
get_user_profile_by_api_key,
) )
from zerver.models.users import get_user_profile_by_api_key
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -78,10 +78,8 @@ from zerver.models import (
UserProfile, UserProfile,
get_realm, get_realm,
get_stream, get_stream,
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
from zproject.backends import ExternalAuthDataDict, ExternalAuthResult, email_auth_enabled from zproject.backends import ExternalAuthDataDict, ExternalAuthResult, email_auth_enabled

View File

@ -104,15 +104,13 @@ from zerver.models import (
UserGroup, UserGroup,
UserMessage, UserMessage,
UserProfile, UserProfile,
active_non_guest_user_ids,
get_default_stream_groups, get_default_stream_groups,
get_realm, get_realm,
get_stream, get_stream,
get_user,
get_user_profile_by_id_in_realm,
validate_attachment_request, validate_attachment_request,
validate_attachment_request_for_spectator_access, validate_attachment_request_for_spectator_access,
) )
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
if TYPE_CHECKING: if TYPE_CHECKING:

View File

@ -4,7 +4,8 @@ from typing_extensions import override
from zerver.actions.message_send import internal_send_private_message from zerver.actions.message_send import internal_send_private_message
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import message_stream_count, most_recent_message from zerver.lib.test_helpers import message_stream_count, most_recent_message
from zerver.models import UserProfile, get_system_bot from zerver.models import UserProfile
from zerver.models.users import get_system_bot
class TutorialTests(ZulipTestCase): class TutorialTests(ZulipTestCase):

View File

@ -46,10 +46,9 @@ from zerver.models import (
RealmDomain, RealmDomain,
UserProfile, UserProfile,
get_realm, get_realm,
get_system_bot,
get_user_by_delivery_email,
validate_attachment_request, validate_attachment_request,
) )
from zerver.models.users import get_system_bot, get_user_by_delivery_email
class FileUploadTest(UploadSerializeMixin, ZulipTestCase): class FileUploadTest(UploadSerializeMixin, ZulipTestCase):

View File

@ -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, get_system_bot from zerver.models import Attachment, RealmEmoji, get_realm
from zerver.models.users import get_system_bot
class LocalStorageTest(UploadSerializeMixin, ZulipTestCase): class LocalStorageTest(UploadSerializeMixin, ZulipTestCase):

View File

@ -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, get_system_bot from zerver.models import Attachment, RealmEmoji, UserProfile, get_realm
from zerver.models.users import get_system_bot
class S3Test(ZulipTestCase): class S3Test(ZulipTestCase):

View File

@ -79,8 +79,10 @@ from zerver.models import (
get_client, get_client,
get_fake_email_domain, get_fake_email_domain,
get_realm, get_realm,
get_source_profile,
get_stream, get_stream,
)
from zerver.models.users import (
get_source_profile,
get_system_bot, get_system_bot,
get_user, get_user,
get_user_by_delivery_email, get_user_by_delivery_email,

View File

@ -21,7 +21,8 @@ from zerver.lib.webhooks.common import (
standardize_headers, standardize_headers,
validate_extract_webhook_http_header, validate_extract_webhook_http_header,
) )
from zerver.models import UserProfile, get_realm, get_user from zerver.models import UserProfile, get_realm
from zerver.models.users import get_user
class WebhooksCommonTestCase(ZulipTestCase): class WebhooksCommonTestCase(ZulipTestCase):

View File

@ -6,7 +6,8 @@ import orjson
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.users import get_api_key from zerver.lib.users import get_api_key
from zerver.models import get_realm, get_user from zerver.models import get_realm
from zerver.models.users import get_user
if TYPE_CHECKING: if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse

View File

@ -20,7 +20,8 @@ from zerver.lib.validator import (
check_string, check_string,
to_non_negative_int, to_non_negative_int,
) )
from zerver.models import Client, UserProfile, get_client, get_user_profile_by_id from zerver.models import Client, UserProfile, get_client
from zerver.models.users import get_user_profile_by_id
from zerver.tornado.descriptors import is_current_port from zerver.tornado.descriptors import is_current_port
from zerver.tornado.event_queue import access_client_descriptor, fetch_events, process_notification from zerver.tornado.event_queue import access_client_descriptor, fetch_events, process_notification
from zerver.tornado.sharding import get_user_tornado_port, notify_tornado_queue_name from zerver.tornado.sharding import get_user_tornado_port, notify_tornado_queue_name

View File

@ -76,8 +76,8 @@ from zerver.models import (
UserProfile, UserProfile,
filter_to_valid_prereg_users, filter_to_valid_prereg_users,
get_realm, get_realm,
remote_user_to_email,
) )
from zerver.models.users import remote_user_to_email
from zerver.signals import email_on_new_login from zerver.signals import email_on_new_login
from zerver.views.errors import config_error from zerver.views.errors import config_error
from zproject.backends import ( from zproject.backends import (

View File

@ -16,7 +16,8 @@ from zerver.actions.users import change_user_is_active
from zerver.lib.email_notifications import enqueue_welcome_emails, send_account_registered_email from zerver.lib.email_notifications import enqueue_welcome_emails, send_account_registered_email
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.models import Realm, get_realm, get_realm_stream, get_user_by_delivery_email from zerver.models import Realm, get_realm, get_realm_stream
from zerver.models.users import get_user_by_delivery_email
from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES from zerver.views.invite import INVITATION_LINK_VALIDITY_MINUTES
from zproject.email_backends import get_forward_address, set_forward_address from zproject.email_backends import get_forward_address, set_forward_address

View File

@ -22,7 +22,8 @@ from zerver.lib.topic import REQ_topic
from zerver.lib.validator import check_bool, check_string_in, to_float from zerver.lib.validator import check_bool, check_string_in, to_float
from zerver.lib.zcommand import process_zcommands from zerver.lib.zcommand import process_zcommands
from zerver.lib.zephyr import compute_mit_user_fullname from zerver.lib.zephyr import compute_mit_user_fullname
from zerver.models import Client, Message, RealmDomain, UserProfile, get_user_including_cross_realm from zerver.models import Client, Message, RealmDomain, UserProfile
from zerver.models.users import get_user_including_cross_realm
class InvalidMirrorInputError(Exception): class InvalidMirrorInputError(Exception):

Some files were not shown because too many files have changed in this diff Show More