message send: Calculate `wildcard_mention_notify` pre-send_event.

This deduplicates some logic, and makes it so that
`wildcard_mention_notify` always contains what its name says it does.
This commit is contained in:
Abhijeet Prasad Bodas 2021-06-11 19:19:02 +05:30 committed by Tim Abbott
parent 919f0a5964
commit 40cd6b5440
2 changed files with 5 additions and 7 deletions

View File

@ -1975,7 +1975,9 @@ def do_send_messages(
users: List[Dict[str, Union[int, List[str], bool]]] = []
for user_id in user_list:
flags = user_flags.get(user_id, [])
wildcard_mention_notify = user_id in send_request.wildcard_mention_user_ids
wildcard_mention_notify = (
user_id in send_request.wildcard_mention_user_ids and "wildcard_mentioned" in flags
)
users.append(
dict(
id=user_id,

View File

@ -749,9 +749,7 @@ def missedmessage_hook(
# stream_push_notify is set in process_message_event.
stream_push_notify = internal_data.get("stream_push_notify", False)
stream_email_notify = internal_data.get("stream_email_notify", False)
wildcard_mention_notify = (
internal_data.get("wildcard_mention_notify", False) and "wildcard_mentioned" in flags
)
wildcard_mention_notify = internal_data.get("wildcard_mention_notify", False)
stream_name = None
if not private_message:
@ -954,9 +952,7 @@ def process_message_event(
mentioned = "mentioned" in flags
stream_push_notify = user_data.get("stream_push_notify", False)
stream_email_notify = user_data.get("stream_email_notify", False)
wildcard_mention_notify = (
user_data.get("wildcard_mention_notify", False) and "wildcard_mentioned" in flags
)
wildcard_mention_notify = user_data.get("wildcard_mention_notify", False)
sender_is_muted = user_data.get("sender_is_muted", False)
extra_user_data[user_profile_id] = dict(