message send: Don't create user data list with inline `for`.

This will make the code more readable, and will allow creating local
variables within the loop for reuse.
This commit is contained in:
Abhijeet Prasad Bodas 2021-06-10 19:51:09 +05:30 committed by Tim Abbott
parent 5a642cea11
commit 56f6656d8b
1 changed files with 12 additions and 11 deletions

View File

@ -1972,7 +1972,9 @@ def do_send_messages(
else: else:
user_list = list(user_ids) user_list = list(user_ids)
users = [ users: List[Dict[str, Union[int, List[str], bool]]] = []
for user_id in user_list:
users.append(
dict( dict(
id=user_id, id=user_id,
flags=user_flags.get(user_id, []), flags=user_flags.get(user_id, []),
@ -1982,8 +1984,7 @@ def do_send_messages(
wildcard_mention_notify=(user_id in send_request.wildcard_mention_user_ids), wildcard_mention_notify=(user_id in send_request.wildcard_mention_user_ids),
sender_is_muted=(user_id in send_request.muted_sender_user_ids), sender_is_muted=(user_id in send_request.muted_sender_user_ids),
) )
for user_id in user_list )
]
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