Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

models: Add comment documenting how email uniqueness is enforced.

Tim Abbott3e9c2dc03dc3
diff --git a/zerver/models.py b/zerver/models.py
index 7f91cf8c07e..97aba1b55df 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -1595,7 +1595,10 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
# compatibility in Zulip APIs where users are referred to by their
# email address, not their ID; it should be used in all API use cases.
#
- # Both fields are unique within a realm (in a case-insensitive fashion).
+ # Both fields are unique within a realm (in a case-insensitive
+ # fashion). Since Django's unique_together is case sensitive, this
+ # is enforced via SQL indexes created by
+ # zerver/migrations/0295_case_insensitive_email_indexes.py.
delivery_email: str = models.EmailField(blank=False, db_index=True)
email: str = models.EmailField(blank=False, db_index=True)