models: Add optional realm_id argument to get_system_bot.

This commit is contained in:
Mateusz Mandera
2021-07-26 13:45:29 +02:00
committed by Tim Abbott
parent c2e038ea2f
commit d45f3eecaa
2 changed files with 2 additions and 2 deletions

View File

@@ -499,7 +499,7 @@ def user_profile_delivery_email_cache_key(delivery_email: str, realm: "Realm") -
return f"user_profile_by_delivery_email:{make_safe_digest(delivery_email.strip())}:{realm.id}"
def bot_profile_cache_key(email: str) -> str:
def bot_profile_cache_key(email: str, realm_id: Optional[int] = None) -> str:
return f"bot_profile:{make_safe_digest(email.strip())}"

View File

@@ -3084,7 +3084,7 @@ def get_user_including_cross_realm(email: str, realm: Optional[Realm] = None) ->
@cache_with_key(bot_profile_cache_key, timeout=3600 * 24 * 7)
def get_system_bot(email: str) -> UserProfile:
def get_system_bot(email: str, realm_id: Optional[int] = None) -> UserProfile:
return UserProfile.objects.select_related().get(email__iexact=email.strip())