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 optional realm_id argument to get_system_bot.

Mateusz Manderad45f3eecaa1d
diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py
index 4b43dc9c476..6d9f14ef9cd 100644
--- a/zerver/lib/cache.py
+++ b/zerver/lib/cache.py
@@ -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())}"
diff --git a/zerver/models.py b/zerver/models.py
index 23de014d7db..b59194453fc 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -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())