Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

email mirror: Avoid silly email lookup.

Steve Howell7c864db8f294
diff --git a/zerver/lib/email_mirror.py b/zerver/lib/email_mirror.py
index 6d3c0ac6f02..0165d1d5e0c 100644
--- a/zerver/lib/email_mirror.py
+++ b/zerver/lib/email_mirror.py
@@ -38,7 +38,7 @@ from zerver.models import (
get_display_recipient,
get_stream_by_id_in_realm,
get_system_bot,
- get_user,
+ get_user_profile_by_id,
)
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)
recipient_str = stream.name
elif recipient.type == Recipient.PERSONAL:
- display_recipient = get_display_recipient(recipient)
- assert not isinstance(display_recipient, str)
- recipient_str = display_recipient[0]["email"]
- recipient_user = get_user(recipient_str, user_profile.realm)
+ recipient_user_id = recipient.type_id
+ recipient_user = get_user_profile_by_id(recipient_user_id)
+ recipient_str = recipient_user.email
internal_send_private_message(user_profile, recipient_user, body)
elif recipient.type == Recipient.HUDDLE:
display_recipient = get_display_recipient(recipient)