mirror of https://github.com/zulip/zulip.git
email mirror: Avoid silly email lookup.
We can search by id, which is more resilient and still hits a cache.
This commit is contained in:
parent
257b32a4a4
commit
7c864db8f2
|
@ -38,7 +38,7 @@ from zerver.models import (
|
||||||
get_display_recipient,
|
get_display_recipient,
|
||||||
get_stream_by_id_in_realm,
|
get_stream_by_id_in_realm,
|
||||||
get_system_bot,
|
get_system_bot,
|
||||||
get_user,
|
get_user_profile_by_id,
|
||||||
)
|
)
|
||||||
from zproject.backends import is_user_active
|
from zproject.backends import is_user_active
|
||||||
|
|
||||||
|
@ -454,10 +454,9 @@ def process_missed_message(to: str, message: EmailMessage) -> None:
|
||||||
send_mm_reply_to_stream(user_profile, stream, topic, body)
|
send_mm_reply_to_stream(user_profile, stream, topic, body)
|
||||||
recipient_str = stream.name
|
recipient_str = stream.name
|
||||||
elif recipient.type == Recipient.PERSONAL:
|
elif recipient.type == Recipient.PERSONAL:
|
||||||
display_recipient = get_display_recipient(recipient)
|
recipient_user_id = recipient.type_id
|
||||||
assert not isinstance(display_recipient, str)
|
recipient_user = get_user_profile_by_id(recipient_user_id)
|
||||||
recipient_str = display_recipient[0]["email"]
|
recipient_str = recipient_user.email
|
||||||
recipient_user = get_user(recipient_str, user_profile.realm)
|
|
||||||
internal_send_private_message(user_profile, recipient_user, body)
|
internal_send_private_message(user_profile, recipient_user, body)
|
||||||
elif recipient.type == Recipient.HUDDLE:
|
elif recipient.type == Recipient.HUDDLE:
|
||||||
display_recipient = get_display_recipient(recipient)
|
display_recipient = get_display_recipient(recipient)
|
||||||
|
|
Loading…
Reference in New Issue