Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
sessions: Only fetch user ids in delete_realm_user_sessions.
Mateusz Mandera003d086f2e64
diff --git a/zerver/lib/sessions.py b/zerver/lib/sessions.pyindex d68e2f19822..e713780a0c4 100644--- a/zerver/lib/sessions.py+++ b/zerver/lib/sessions.py@@ -47,7 +47,7 @@ def delete_user_sessions(user_profile: UserProfile) -> None:def delete_realm_user_sessions(realm: Realm) -> None:- realm_user_ids = [user_profile.id for user_profile in UserProfile.objects.filter(realm=realm)]+ realm_user_ids = list(UserProfile.objects.filter(realm=realm).values_list("id", flat=True))for session in Session.objects.filter(expire_date__gte=timezone_now()):if get_session_user(session) in realm_user_ids:delete_session(session)