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.

sessions: Use the narrow user fetch when expiring sessions.

Alex Vandiver44f0e936c20a
diff --git a/zerver/lib/sessions.py b/zerver/lib/sessions.py
index 8520adb9ca9..bcd719a7b64 100644
--- a/zerver/lib/sessions.py
+++ b/zerver/lib/sessions.py
@@ -16,7 +16,7 @@ from django.utils.timezone import now as timezone_now
from zerver.lib.request import RequestNotes
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.models import Realm, UserProfile
-from zerver.models.users import get_user_profile_by_id, get_user_profile_narrow_by_id
+from zerver.models.users import get_user_profile_narrow_by_id
class SessionEngine(Protocol):
@@ -71,7 +71,7 @@ def delete_all_deactivated_user_sessions() -> None:
user_profile_id = get_session_user_id(session)
if user_profile_id is None: # nocoverage # TODO: Investigate why we lost coverage on this
continue
- user_profile = get_user_profile_by_id(user_profile_id)
+ user_profile = get_user_profile_narrow_by_id(user_profile_id)
if not user_profile.is_active or user_profile.realm.deactivated:
logging.info("Deactivating session for deactivated user %s", user_profile.id)
delete_session(session)