mirror of https://github.com/zulip/zulip.git
message send: Refactor how user data is sent for the event.
This is a prep change for calling `get_active_presence_idle_user_ids` after we have collected all user data variables, so that that function does not erroneously skip some user IDs from not having the complete data.
This commit is contained in:
parent
3ff3ded1ae
commit
42e4fa7952
|
@ -1973,27 +1973,27 @@ def do_send_messages(
|
||||||
else:
|
else:
|
||||||
user_list = list(user_ids)
|
user_list = list(user_ids)
|
||||||
|
|
||||||
users: List[Dict[str, Union[int, List[str], bool]]] = []
|
user_data_objects: List[UserMessageNotificationsData] = []
|
||||||
for user_id in user_list:
|
for user_id in user_list:
|
||||||
flags = user_flags.get(user_id, [])
|
flags = user_flags.get(user_id, [])
|
||||||
wildcard_mention_notify = (
|
wildcard_mention_notify = (
|
||||||
user_id in send_request.wildcard_mention_user_ids and "wildcard_mentioned" in flags
|
user_id in send_request.wildcard_mention_user_ids and "wildcard_mentioned" in flags
|
||||||
)
|
)
|
||||||
users.append(
|
user_data_objects.append(
|
||||||
asdict(
|
UserMessageNotificationsData(
|
||||||
UserMessageNotificationsData(
|
id=user_id,
|
||||||
id=user_id,
|
flags=flags,
|
||||||
flags=flags,
|
mentioned=("mentioned" in flags),
|
||||||
mentioned=("mentioned" in flags),
|
online_push_enabled=(user_id in send_request.online_push_user_ids),
|
||||||
online_push_enabled=(user_id in send_request.online_push_user_ids),
|
stream_push_notify=(user_id in send_request.stream_push_user_ids),
|
||||||
stream_push_notify=(user_id in send_request.stream_push_user_ids),
|
stream_email_notify=(user_id in send_request.stream_email_user_ids),
|
||||||
stream_email_notify=(user_id in send_request.stream_email_user_ids),
|
wildcard_mention_notify=wildcard_mention_notify,
|
||||||
wildcard_mention_notify=wildcard_mention_notify,
|
sender_is_muted=(user_id in send_request.muted_sender_user_ids),
|
||||||
sender_is_muted=(user_id in send_request.muted_sender_user_ids),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
users = [asdict(user_data_object) for user_data_object in user_data_objects]
|
||||||
|
|
||||||
if send_request.message.is_stream_message():
|
if send_request.message.is_stream_message():
|
||||||
# Note: This is where authorization for single-stream
|
# Note: This is where authorization for single-stream
|
||||||
# get_updates happens! We only attach stream data to the
|
# get_updates happens! We only attach stream data to the
|
||||||
|
|
Loading…
Reference in New Issue