Rename presence_idle_userids -> presence_idle_user_ids.

This commit is contained in:
Steve Howell
2017-10-07 08:59:19 -07:00
committed by showell
parent e3ee0245c4
commit 10a30bece1
4 changed files with 14 additions and 14 deletions

View File

@@ -1019,7 +1019,7 @@ def do_send_messages(messages_maybe_none):
sender = message['message'].sender
message_type = message_dict_no_markdown['type']
presence_idle_userids = get_active_presence_idle_userids(
presence_idle_user_ids = get_active_presence_idle_user_ids(
realm=sender.realm,
sender_id=sender.id,
message_type=message_type,
@@ -1032,7 +1032,7 @@ def do_send_messages(messages_maybe_none):
message=message['message'].id,
message_dict_markdown=message_dict_markdown,
message_dict_no_markdown=message_dict_no_markdown,
presence_idle_userids=presence_idle_userids,
presence_idle_user_ids=presence_idle_user_ids,
)
users = [
@@ -3261,7 +3261,7 @@ def do_update_message(user_profile, message, subject, propagate_mode,
event['stream_push_user_ids'] = list(info['stream_push_user_ids'])
event['prior_mention_user_ids'] = list(prior_mention_user_ids)
event['mention_user_ids'] = list(mention_user_ids)
event['presence_idle_userids'] = filter_presence_idle_userids(info['active_user_ids'])
event['presence_idle_user_ids'] = filter_presence_idle_user_ids(info['active_user_ids'])
if subject is not None:
orig_subject = message.topic_name()
@@ -3530,7 +3530,7 @@ def gather_subscriptions(user_profile):
return (subscribed, unsubscribed)
def get_active_presence_idle_userids(realm, sender_id, message_type, active_user_ids, user_flags):
def get_active_presence_idle_user_ids(realm, sender_id, message_type, active_user_ids, user_flags):
# type: (Realm, int, str, Set[int], Dict[int, List[str]]) -> List[int]
'''
Given a list of active_user_ids, we build up a subset
@@ -3555,9 +3555,9 @@ def get_active_presence_idle_userids(realm, sender_id, message_type, active_user
if mentioned or private_message:
user_ids.add(user_id)
return filter_presence_idle_userids(user_ids)
return filter_presence_idle_user_ids(user_ids)
def filter_presence_idle_userids(user_ids):
def filter_presence_idle_user_ids(user_ids):
# type: (Set[int]) -> List[int]
if not user_ids:
return []

View File

@@ -587,7 +587,7 @@ class EventsRegisterTest(ZulipTestCase):
('message_ids', check_list(check_int)),
('prior_mention_user_ids', check_list(check_int)),
('mention_user_ids', check_list(check_int)),
('presence_idle_userids', check_list(check_int)),
('presence_idle_user_ids', check_list(check_int)),
('stream_push_user_ids', check_list(check_int)),
('push_notify_user_ids', check_list(check_int)),
('orig_content', check_string),

View File

@@ -15,7 +15,7 @@ from zerver.lib.addressee import Addressee
from zerver.lib.actions import (
do_send_messages,
get_active_presence_idle_userids,
get_active_presence_idle_user_ids,
get_user_info_for_message_updates,
internal_send_private_message,
)
@@ -2131,7 +2131,7 @@ class AttachmentTest(ZulipTestCase):
self.assertTrue(attachment.is_claimed())
class MissedMessageTest(ZulipTestCase):
def test_presence_idle_userids(self):
def test_presence_idle_user_ids(self):
# type: () -> None
UserPresence.objects.all().delete()
@@ -2145,14 +2145,14 @@ class MissedMessageTest(ZulipTestCase):
def assert_missing(user_ids):
# type: (List[int]) -> None
presence_idle_userids = get_active_presence_idle_userids(
presence_idle_user_ids = get_active_presence_idle_user_ids(
realm=realm,
sender_id=sender.id,
message_type=message_type,
active_user_ids=recipient_ids,
user_flags=user_flags,
)
self.assertEqual(sorted(user_ids), sorted(presence_idle_userids))
self.assertEqual(sorted(user_ids), sorted(presence_idle_user_ids))
def set_presence(user_id, client_name, ago):
# type: (int, Text, int) -> None

View File

@@ -709,7 +709,7 @@ def maybe_enqueue_notifications(user_profile_id, message_id, private_message,
def process_message_event(event_template, users):
# type: (Mapping[str, Any], Iterable[Mapping[str, Any]]) -> None
presence_idle_userids = set(event_template.get('presence_idle_userids', []))
presence_idle_user_ids = set(event_template.get('presence_idle_user_ids', []))
sender_queue_id = event_template.get('sender_queue_id', None) # type: Optional[str]
message_dict_markdown = event_template['message_dict_markdown'] # type: Dict[str, Any]
message_dict_no_markdown = event_template['message_dict_no_markdown'] # type: Dict[str, Any]
@@ -748,7 +748,7 @@ def process_message_event(event_template, users):
# We first check if a message is potentially mentionable,
# since receiver_is_off_zulip is somewhat expensive.
if private_message or mentioned or stream_push_notify:
idle = receiver_is_off_zulip(user_profile_id) or (user_profile_id in presence_idle_userids)
idle = receiver_is_off_zulip(user_profile_id) or (user_profile_id in presence_idle_user_ids)
always_push_notify = user_data.get('always_push_notify', False)
stream_name = event_template.get('stream_name')
result = maybe_enqueue_notifications(user_profile_id, message_id, private_message,
@@ -823,7 +823,7 @@ def process_message_update_event(event_template, users):
# type: (Mapping[str, Any], Iterable[Mapping[str, Any]]) -> None
prior_mention_user_ids = set(event_template.get('prior_mention_user_ids', []))
mention_user_ids = set(event_template.get('mention_user_ids', []))
presence_idle_user_ids = set(event_template.get('presence_idle_userids', []))
presence_idle_user_ids = set(event_template.get('presence_idle_user_ids', []))
stream_push_user_ids = set(event_template.get('stream_push_user_ids', []))
push_notify_user_ids = set(event_template.get('push_notify_user_ids', []))