mirror of https://github.com/zulip/zulip.git
notifications: Elimininate now-unnecessary database query.
Because we're passing through the trigger for notifications to do_send_missedmessage_events_reply_in_zulip, we don't need to go back to the database to determine which messages actually mentioned the user.
This commit is contained in:
parent
dabf3667d1
commit
47df8c0c6e
|
@ -361,14 +361,14 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,
|
|||
context.update({'huddle_display_name': huddle_display_name})
|
||||
elif (missed_messages[0]['message'].recipient.type == Recipient.PERSONAL):
|
||||
context.update({'private_message': True})
|
||||
else:
|
||||
elif context['mention']:
|
||||
# Keep only the senders who actually mentioned the user
|
||||
#
|
||||
# TODO: When we add wildcard mentions that send emails, add
|
||||
# them to the filter here.
|
||||
senders = list(set(m['message'].sender for m in missed_messages if
|
||||
UserMessage.objects.filter(message=m['message'], user_profile=user_profile,
|
||||
flags=UserMessage.flags.mentioned).exists()))
|
||||
senders = list(set(m['message'].sender for m in missed_messages
|
||||
if m['trigger'] == 'mentioned'))
|
||||
# TODO: When we add wildcard mentions that send emails, we
|
||||
# should make sure the right logic applies here.
|
||||
else:
|
||||
raise AssertionError("Invalid messages!")
|
||||
|
||||
# If message content is disabled, then flush all information we pass to email.
|
||||
if not user_profile.message_content_in_email_notifications:
|
||||
|
|
Loading…
Reference in New Issue