From d6672c57ffb58b960e1d52640c0fd83ccd94dfcd Mon Sep 17 00:00:00 2001 From: Vector73 Date: Wed, 15 May 2024 21:52:16 +0530 Subject: [PATCH] user_status: Rename `get_user_status_dict` function. Renames `get_user_status_dict` function to `get_all_users_status_dict` to distinguish it from new `get_user_status` function. --- zerver/lib/events.py | 4 ++-- zerver/lib/user_status.py | 2 +- zerver/tests/test_user_status.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zerver/lib/events.py b/zerver/lib/events.py index 1ef901161e..b33368e2f2 100644 --- a/zerver/lib/events.py +++ b/zerver/lib/events.py @@ -60,7 +60,7 @@ from zerver.lib.user_groups import ( get_server_supported_permission_settings, user_groups_in_realm_serialized, ) -from zerver.lib.user_status import get_user_status_dict +from zerver.lib.user_status import get_all_users_status_dict from zerver.lib.user_topics import get_topic_mutes, get_user_topics from zerver.lib.users import ( get_cross_realm_dicts, @@ -681,7 +681,7 @@ def fetch_initial_state_data( state["user_status"] = ( {} if user_profile is None - else get_user_status_dict(realm=realm, user_profile=user_profile) + else get_all_users_status_dict(realm=realm, user_profile=user_profile) ) if want("user_topic"): diff --git a/zerver/lib/user_status.py b/zerver/lib/user_status.py index b6d1f414fc..81f1fb645c 100644 --- a/zerver/lib/user_status.py +++ b/zerver/lib/user_status.py @@ -49,7 +49,7 @@ def format_user_status(row: RawUserInfoDict) -> UserInfoDict: return dct -def get_user_status_dict(realm: Realm, user_profile: UserProfile) -> Dict[str, UserInfoDict]: +def get_all_users_status_dict(realm: Realm, user_profile: UserProfile) -> Dict[str, UserInfoDict]: query = UserStatus.objects.filter( user_profile__realm_id=realm.id, user_profile__is_active=True, diff --git a/zerver/tests/test_user_status.py b/zerver/tests/test_user_status.py index 492e347501..9298c9dcd9 100644 --- a/zerver/tests/test_user_status.py +++ b/zerver/tests/test_user_status.py @@ -3,7 +3,7 @@ from typing import Any, Dict, Optional import orjson from zerver.lib.test_classes import ZulipTestCase -from zerver.lib.user_status import UserInfoDict, get_user_status_dict, update_user_status +from zerver.lib.user_status import UserInfoDict, get_all_users_status_dict, update_user_status from zerver.models import UserProfile, UserStatus from zerver.models.clients import get_client @@ -11,7 +11,7 @@ from zerver.models.clients import get_client def user_status_info(user: UserProfile, acting_user: Optional[UserProfile] = None) -> UserInfoDict: if acting_user is None: acting_user = user - user_dict = get_user_status_dict(user.realm, acting_user) + user_dict = get_all_users_status_dict(user.realm, acting_user) return user_dict.get(str(user.id), {}) @@ -286,7 +286,7 @@ class UserStatusTest(ZulipTestCase): expected_event=dict(type="user_status", user_id=hamlet.id, status_text=""), ) self.assertEqual( - get_user_status_dict(realm=realm, user_profile=hamlet), + get_all_users_status_dict(realm=realm, user_profile=hamlet), {}, )