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.

users: Pass realm as arg to select_related in fetch_users_by_id.

Sahil Batrac0029319f997
diff --git a/zerver/lib/users.py b/zerver/lib/users.py
index 6e57bd9bf1e..be3c5a0cd22 100644
--- a/zerver/lib/users.py
+++ b/zerver/lib/users.py
@@ -223,7 +223,7 @@ def user_ids_to_users(user_ids: Sequence[int], realm: Realm) -> List[UserProfile
# users should be included.
def fetch_users_by_id(user_ids: List[int]) -> List[UserProfile]:
- return list(UserProfile.objects.filter(id__in=user_ids).select_related())
+ return list(UserProfile.objects.filter(id__in=user_ids).select_related("realm"))
user_profiles_by_id: Dict[int, UserProfile] = bulk_cached_fetch(
cache_key_function=user_profile_by_id_cache_key,