Skip to content

Commit

Permalink
user_status: Rename get_user_status_dict function.
Browse files Browse the repository at this point in the history
Renames `get_user_status_dict` function to `get_all_users_status_dict`
to distinguish it from new `get_user_status` function.
  • Loading branch information
Vector73 authored and timabbott committed May 23, 2024
1 parent 20d6dd1 commit d6672c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions zerver/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
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,
Expand Down Expand Up @@ -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"):
Expand Down
2 changes: 1 addition & 1 deletion zerver/lib/user_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions zerver/tests/test_user_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
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


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), {})


Expand Down Expand Up @@ -286,7 +286,7 @@ def test_endpoints(self) -> None:
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),
{},
)

Expand Down

0 comments on commit d6672c5

Please sign in to comment.