zulip/zerver/lib
Mateusz Mandera fe993032a6 validate_email_not_already_in_realm: Add kwarg for mirror dummies.
In user signup context, we are okay with there being an existing mirror
dummy user with the matching email - at the end of the signup, that
mirror dummy account will be activated and control of it given to the
user doing this signup.

However, in email change contexts (SCIM API and regular email change
flow), we can't change an account's email address to the address that
already belongs to an existing mirror dummy user.

To avoid subtle bugs like this, we make callers have to explicitly
specify whether existance of mirror dummies with the matching email
address is okay or not.
2025-07-07 17:15:08 -07:00
..
markdown url_encoding: Standardize to use encode_hash_component. 2025-07-03 14:40:49 -07:00
upload s3: Support non-AWS S3 providers which do not support request checksums. 2025-04-10 11:11:25 -07:00
url_preview python: Replace deprecated BeautifulSoup.findAll. 2025-02-18 22:04:43 -08:00
webhooks integrations: Use directory name to get HTTP headers from fixtures. 2025-06-09 15:59:39 -07:00
__init__.py
addressee.py addressee: Rename "(no topic)" to empty string topic. 2025-03-19 11:39:28 -07:00
alert_words.py alert_words: Update remove_alert_word codepath to send event on commit. 2024-07-31 22:33:52 -07:00
async_utils.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
attachments.py attachments: Use early return and improve comments. 2025-04-23 17:34:09 -07:00
avatar_hash.py avatars: Encode version into the filename. 2024-07-07 14:40:07 -07:00
avatar.py avatar: Add option to disable gravatars per realm. 2025-01-30 18:46:02 -08:00
bot_config.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
bot_lib.py worker: Flag messages processed by outgoing bot. 2025-01-24 17:56:44 -08:00
bot_storage.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
bulk_create.py stream_settings: Add new topics_policy setting. 2025-06-17 17:05:58 -07:00
cache_helpers.py cache_helpers: Stop pre-filling the non-narrow user cache. 2025-02-18 12:17:54 -08:00
cache.py settings: Do not pre-fetch DM permission group settings. 2025-04-07 15:34:30 -07:00
camo.py typing: Apply trivial none-checks with assertions as necessary. 2022-06-23 19:25:48 -07:00
ccache.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
channel_folders.py folders: Don't allow archiving a folder if it contains channels. 2025-05-29 15:39:03 -07:00
compatibility.py ruff: Fix PLR6104 Use += to perform an augmented assignment directly. 2024-07-14 13:49:51 -07:00
context_managers.py ruff: Fix SIM117 Use a single with statement with multiple contexts. 2024-07-14 13:48:32 -07:00
create_user.py api: Improve handling of delivery_email in the GET /users/{email} API. 2024-10-08 18:01:49 -07:00
db_connections.py db: Split reset_queries into a new module zerver.lib.db_connections. 2024-04-17 16:49:03 -07:00
db.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
debug.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
default_streams.py default streams: Return set instead of a list. 2025-01-22 10:55:25 -08:00
demo_organizations.py demo-orgs: Delete expired demo orgs in archive_messages cron job. 2025-06-07 22:53:01 -07:00
dev_ldap_directory.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
digest.py CVE-2025-52559: Generate HTML for digest new channels safely. 2025-07-02 12:12:36 -07:00
display_recipient.py mypy: Remove use of ValuesQuerySet and QuerySetAny. 2024-08-24 17:30:41 -07:00
domains.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
drafts.py drafts: Update do_delete_draft to send event on commit. 2024-08-12 12:16:14 -07:00
email_mirror_helpers.py email_mirror: Fail more gracefully on empty EMAIL_GATEWAY_PATTERN. 2025-07-02 10:21:08 -07:00
email_mirror_server.py email_mirror_server: Swallow and log all TLSSetupExceptions. 2025-06-09 10:29:33 -07:00
email_mirror.py email_mirror: Also strip "SV:" from subject. 2025-05-29 10:55:18 -07:00
email_notifications.py CVE-2025-52559: Generate HTML for digest message sender safely. 2025-07-02 12:12:36 -07:00
email_validation.py validate_email_not_already_in_realm: Add kwarg for mirror dummies. 2025-07-07 17:15:08 -07:00
emoji_utils.py emoji: Match emoji sequences in markdown. 2023-08-23 16:18:15 -07:00
emoji.py emoji: Use a non-predictable filename. 2024-07-12 13:26:47 -07:00
event_schema.py zerver: Add endpoints and events for reminders. 2025-07-02 12:47:00 -07:00
event_types.py zerver: Add endpoints and events for reminders. 2025-07-02 12:47:00 -07:00
events.py zerver: Add endpoints and events for reminders. 2025-07-02 12:47:00 -07:00
exceptions.py stream_settings: Add new topics_policy setting. 2025-06-17 17:05:58 -07:00
export.py navigation_views: Add backend for navigation views in left sidebar. 2025-05-23 16:25:08 -07:00
external_accounts.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
fix_unreads.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
generate_test_data.py ruff: Fix PLR6104 Use += to perform an augmented assignment directly. 2024-07-14 13:49:51 -07:00
github.py apps: Provide arm64 app build by default for macOS. 2025-03-28 16:45:07 -07:00
home.py home: Add a modal to replace /try-zulip landing page. 2025-04-03 13:01:48 -07:00
html_diff.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
html_to_text.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
i18n.py registration: Fix language code missing for find_team emails. 2025-03-24 14:41:23 -07:00
import_realm.py navigation_views: Add backend for navigation views in left sidebar. 2025-05-23 16:25:08 -07:00
initial_password.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
integrations.py webhooks/opsgenie: Support linking to EU instances. 2025-06-25 11:52:02 -07:00
invites.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
logging_util.py logging_util: Error-proof against weird exc_info. 2025-05-19 16:39:44 -07:00
management.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
mdiff.py tests: Rename the Node tests to *.cjs. 2024-11-13 09:18:56 -08:00
mention.py topics: Server generated permalinks now prefer latest message id. 2025-07-03 11:06:39 -07:00
message_cache.py messages: Use "\x07" as topic for DMs and group DMs. 2025-06-19 10:44:37 -07:00
message_report.py report_message: Use existing template for reporting 1:1 DM via DM group. 2025-06-18 12:46:23 -07:00
message.py report_message: Use existing template for reporting 1:1 DM via DM group. 2025-06-18 12:46:23 -07:00
migrate.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
migration_status.py migration_status: Refactor parse_migration_status. 2025-03-20 10:57:54 -07:00
mime_types.py mime_types: Move INLINE_MIME_TYPES to prevent future import loops. 2025-01-09 09:09:13 -08:00
mobile_auth_otp.py ruff: Fix B905 zip() without an explicit strict= parameter. 2024-07-13 22:28:22 -07:00
muted_users.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
name_restrictions.py signup: Add "airsi.de" as an allowed email domain. 2025-03-19 10:04:11 -07:00
narrow_helpers.py url_decoding: Add parse_narrow_url. 2025-02-24 15:37:40 -08:00
narrow_predicate.py narrow_term: Refactor a NeverNegatedNarrowTerm. 2025-02-24 15:37:40 -08:00
narrow.py narrow: Fix get_base_query_for_search access restrictions. 2025-04-10 15:26:57 -07:00
navigation_views.py navigation_views: Add backend for navigation views in left sidebar. 2025-05-23 16:25:08 -07:00
notes.py ruff: Fix FURB180 Use of metaclass=abc.ABCMeta. 2024-07-14 13:53:40 -07:00
notification_data.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
onboarding_steps.py onboarding_steps: Add 'navigation_tour_video' for new users. 2025-03-13 14:38:16 -07:00
onboarding.py demo-orgs: Expand note about demo organizations in Welcome bot DM. 2025-04-29 09:33:46 -07:00
outgoing_http.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
outgoing_webhook.py url_encoding: Add support for with message links. 2025-06-30 11:19:00 -07:00
partial.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
per_request_cache.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
presence.py presence: Add history_limit_days param to the API. 2024-09-10 13:15:35 -07:00
profile.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
push_notifications.py validate_token: Move validate_token to avoid dependency cycle. 2025-07-06 21:11:26 -07:00
pysa.py
query_helpers.py mypy: Remove use of ValuesQuerySet and QuerySetAny. 2024-08-24 17:30:41 -07:00
queue.py queue: Round-trip events through orjson in tests. 2025-03-18 11:53:51 -07:00
rate_limiter.py zilencer: Add flow for a server to reclaim its registration. 2025-01-28 11:10:50 -08:00
realm_description.py markdown: Refactor out additional properties added to Message. 2021-06-24 18:14:53 -07:00
realm_icon.py settings: Make DEFAULT_LOGO_URI/DEFAULT_AVATAR_URI use staticfiles. 2023-02-14 17:17:06 -05:00
realm_logo.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
recipient_parsing.py scheduled_messages: Migrate to typed_endpoint. 2024-08-20 10:03:22 -07:00
recipient_users.py direct_messages: Use DM groups for 1:1 or self DMs if present. 2025-05-18 23:58:59 -07:00
redis_utils.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
reminders.py reminders: Fix poll and todo list not correctly formatted for reminder. 2025-07-02 13:02:53 -07:00
remote_server.py management: Don't silence send_server_data_to_push_bouncer exceptions. 2025-02-19 17:11:35 -08:00
request.py middleware: Parse Accept header properly. 2025-03-26 22:29:09 -07:00
response.py test_classes: Refine assert_json_success output with exception chaining. 2024-12-04 11:38:45 -08:00
rest.py rest_api: Add logging for use of the deprecated method parameter. 2025-04-24 13:10:52 -07:00
retention.py retention: Add flag to ArchiveTransaction to prevent automatic deletion. 2025-02-04 11:31:13 -08:00
safe_session_cached_db.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
scheduled_messages.py zerver: Add endpoints and events for reminders. 2025-07-02 12:47:00 -07:00
scim_filter.py zerver: Replace uri with url in local variables and comments. 2024-07-14 22:30:28 -07:00
scim.py validate_email_not_already_in_realm: Add kwarg for mirror dummies. 2025-07-07 17:15:08 -07:00
send_email.py send_email: Only attempt suppression list removal with credentials. 2025-05-28 10:49:17 -07:00
server_initialization.py migration: Rename 'populate_db' Client to 'ZulipDataImport'. 2025-05-08 12:18:34 -07:00
sessions.py sessions: Use the narrow user fetch when expiring sessions. 2025-02-13 12:40:53 -08:00
singleton_bmemcached.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
soft_deactivation.py soft_deactivation: Remove unnecessary nocoverage lines. 2025-05-20 10:35:14 -07:00
sounds.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
sqlalchemy_utils.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
storage.py storage: Simplify system bot avatar logic. 2024-10-25 10:59:57 -07:00
stream_color.py codespell: Fix typos caught by codespell. 2025-02-18 22:04:43 -08:00
stream_subscription.py stream: Add subscriber_count field. 2025-05-13 17:36:53 -07:00
stream_topic.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
stream_traffic.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
streams.py stream_setting: Add setting for who can move messages out of channel. 2025-06-24 16:52:53 -07:00
string_validation.py message_send: Add support to send message with an empty topic name. 2025-01-07 17:24:00 -08:00
subdomains.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
subscription_info.py subscription_data: Flesh out partial suscription data sent to client. 2025-06-30 17:10:36 -07:00
templates.py CVE-2025-52559: Generate HTML for digest new channels safely. 2025-07-02 12:12:36 -07:00
test_classes.py test_classes: Use "pk" instead of "id" for primary key lookup. 2025-07-06 21:07:27 -07:00
test_console_output.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
test_data.source.txt Rename default branch to ‘main’. 2021-09-06 12:56:35 -07:00
test_fixtures.py requirements: Migrate to uv. 2025-02-24 22:29:24 -08:00
test_helpers.py ruff: Fix FURB122 Use of f.write in a for loop. 2025-06-25 11:49:02 -07:00
test_runner.py ruff: Fix FURB122 Use of f.write in a for loop. 2025-06-25 11:49:02 -07:00
tex.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
thumbnail.py requirements: Upgrade Python requirements. 2025-06-25 11:49:02 -07:00
timeout.py ruff: Fix UP035 Import from collections.abc, typing instead. 2024-07-13 22:28:22 -07:00
timestamp.py python: Consistently use from…import for datetime. 2023-12-05 12:01:18 -08:00
timezone.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
topic_link_util.py url_encoding: Standardize to use encode_hash_component. 2025-07-03 14:40:49 -07:00
topic_sqlalchemy.py topic: Enforce is_channel_message=True on topic queries. 2025-03-18 09:34:11 -07:00
topic.py topics: Server generated permalinks now prefer latest message id. 2025-07-03 11:06:39 -07:00
transfer.py upload: Rename "upload_image_to_s3"; it is not only for images. 2024-09-09 12:40:17 -07:00
typed_endpoint_validators.py zerver: Extract function to parse Enum from string value. 2025-05-13 16:04:43 -07:00
typed_endpoint.py requirements: Upgrade Python requirements. 2025-01-14 09:42:16 -08:00
types.py stream_setting: Add setting for who can move messages out of channel. 2025-06-24 16:52:53 -07:00
url_decoding.py url_decoding: Add parse_narrow_url. 2025-02-24 15:37:40 -08:00
url_encoding.py url_encoding: Refactor a encode_user_full_name_and_id. 2025-07-03 14:40:49 -07:00
url_redirects.py corporate: Replace /try-zulip with /?show_try_zulip_modal. 2025-04-03 13:01:48 -07:00
user_agent.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
user_counts.py ruff: Fix UP006 Use list instead of List for type annotation. 2024-07-13 22:28:22 -07:00
user_groups.py requirements: Upgrade django-cte from 1.3.3 to 2.0.0.dev. 2025-06-11 16:25:25 -07:00
user_message.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
user_status.py ruff: Fix UP007 Use X | Y for type annotations. 2024-07-13 22:28:22 -07:00
user_topics.py user_topics: Use a list instead of tuple for muted_topics. 2025-03-17 14:21:37 -07:00
users.py events: Add option to send partial data. 2025-05-19 16:58:56 -07:00
utils.py mattermost_import: Log when processing messages. 2025-05-21 16:08:30 -07:00
validator.py requirements: Upgrade Python requirements. 2025-06-25 11:49:02 -07:00
widget.py python: Simplify with str.removeprefix, str.removesuffix. 2024-09-03 12:30:16 -07:00
zcommand.py python: Simplify with str.removeprefix, str.removesuffix. 2024-09-03 12:30:16 -07:00
zephyr.py zephyr: Switch from py3dns to dnspython. 2025-02-25 11:53:08 -08:00
zulip_update_announcements.py help: Use final Flutter blog post URL. 2025-06-17 13:05:45 -07:00