Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
cache: Delete user_profile_by_email_cache_key.
Mateusz Mandera82d6d925e51a
diff --git a/zerver/lib/cache.py b/zerver/lib/cache.pyindex 6b72285a2fd..9ddb6577e2d 100644--- a/zerver/lib/cache.py+++ b/zerver/lib/cache.py@@ -487,13 +487,6 @@ def display_recipient_bulk_get_users_by_id_cache_key(user_id: int) -> str:return "bulk_fetch_display_recipients:" + user_profile_by_id_cache_key(user_id)-def user_profile_by_email_cache_key(email: str) -> str:- # See the comment in zerver/lib/avatar_hash.py:gravatar_hash for why we- # are proactively encoding email addresses even though they will- # with high likelihood be ASCII-only for the foreseeable future.- return f"user_profile_by_email:{make_safe_digest(email.strip())}"--def user_profile_cache_key_id(email: str, realm_id: int) -> str:return f"user_profile:{make_safe_digest(email.strip())}:{realm_id}"@@ -585,7 +578,6 @@ def delete_user_profile_caches(user_profiles: Iterable["UserProfile"]) -> None:keys = []for user_profile in user_profiles:- keys.append(user_profile_by_email_cache_key(user_profile.delivery_email))keys.append(user_profile_by_id_cache_key(user_profile.id))for api_key in get_all_api_keys(user_profile):keys.append(user_profile_by_api_key_cache_key(api_key))diff --git a/zerver/models.py b/zerver/models.pyindex f793100f184..d28ebd6da8f 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -62,7 +62,6 @@ from zerver.lib.cache import (realm_user_dict_fields,realm_user_dicts_cache_key,user_profile_by_api_key_cache_key,- user_profile_by_email_cache_key,user_profile_by_id_cache_key,user_profile_cache_key,)@@ -2617,9 +2616,8 @@ def get_user_profile_by_id(uid: int) -> UserProfile:return UserProfile.objects.select_related().get(id=uid)-@cache_with_key(user_profile_by_email_cache_key, timeout=3600 * 24 * 7)def get_user_profile_by_email(email: str) -> UserProfile:- """This function is intended to be used by our unit tests and for+ """This function is intended to be used formanual manage.py shell work; robust code must use get_user orget_user_by_delivery_email instead, because Zulip supportsmultiple users with a given (delivery) email address existing on a