presence: Rename get_status_dict_by_user().

This commit is contained in:
Steve Howell 2020-02-06 16:52:12 +00:00 committed by Tim Abbott
parent 675f8514e8
commit bf3baa14ac
3 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ from zerver.lib.message import (
from zerver.lib.narrow import check_supported_events_narrow_filter, read_stop_words
from zerver.lib.presence import (
get_presences_for_realm,
get_status_dict_by_user
get_presence_for_user,
)
from zerver.lib.push_notifications import push_notifications_enabled
from zerver.lib.soft_deactivation import reactivate_user_if_soft_deactivated
@ -616,7 +616,7 @@ def apply_event(state: Dict[str, Any],
user_key = str(event['user_id'])
else:
user_key = event['email']
state['presences'][user_key] = get_status_dict_by_user(
state['presences'][user_key] = get_presence_for_user(
event['user_id'], slim_presence)[user_key]
elif event['type'] == "update_message":
# We don't return messages in /register, so we don't need to

View File

@ -77,8 +77,8 @@ def get_status_dicts_for_rows(presence_rows: List[Dict[str, Any]],
return user_statuses
def get_status_dict_by_user(user_profile_id: int,
slim_presence: bool=False) -> Dict[str, Dict[str, Any]]:
def get_presence_for_user(user_profile_id: int,
slim_presence: bool=False) -> Dict[str, Dict[str, Any]]:
query = UserPresence.objects.filter(user_profile_id=user_profile_id).values(
'client__name',
'status',

View File

@ -14,7 +14,7 @@ from zerver.lib.actions import (
)
from zerver.lib.presence import (
get_presence_response,
get_status_dict_by_user,
get_presence_for_user,
)
from zerver.lib.request import has_request_variables, REQ, JsonableError
from zerver.lib.response import json_success, json_error
@ -35,7 +35,7 @@ def get_presence_backend(request: HttpRequest, user_profile: UserProfile,
if target.is_bot:
return json_error(_('Presence is not supported for bot users.'))
presence_dict = get_status_dict_by_user(target.id)
presence_dict = get_presence_for_user(target.id)
if len(presence_dict) == 0:
return json_error(_('No presence data for %s') % (target.email,))