users: Remove weird get_all_api_keys helper.

This implied by its name that users could have more than one key.
They cannot, currently; make the code clearer by switching to the
explicit column access.
This commit is contained in:
Alex Vandiver
2025-02-11 21:42:38 +00:00
committed by Tim Abbott
parent c29e11de93
commit 8804c1afaa
5 changed files with 38 additions and 38 deletions

View File

@@ -511,14 +511,13 @@ def bot_dicts_in_realm_cache_key(realm_id: int) -> str:
def delete_user_profile_caches(user_profiles: Iterable["UserProfile"], realm_id: int) -> None:
# Imported here to avoid cyclic dependency.
from zerver.lib.users import get_all_api_keys
from zerver.models.users import is_cross_realm_bot_email
keys = []
for user_profile in user_profiles:
keys.append(user_profile_by_id_cache_key(user_profile.id))
keys.append(user_profile_narrow_by_id_cache_key(user_profile.id))
keys += map(user_profile_by_api_key_cache_key, get_all_api_keys(user_profile))
keys.append(user_profile_by_api_key_cache_key(user_profile.api_key))
keys.append(user_profile_cache_key_id(user_profile.email, realm_id))
keys.append(user_profile_delivery_email_cache_key(user_profile.delivery_email, realm_id))
if user_profile.is_bot and is_cross_realm_bot_email(user_profile.email):