Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message: Add recipient_users parameter to internal_send_huddle_message.
Prakhar Pratyushdb214c83777c
diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.pyindex fe677bbdd17..746e0012d24 100644--- a/zerver/actions/message_send.py+++ b/zerver/actions/message_send.py@@ -1997,9 +1997,16 @@ def internal_prep_huddle_message(def internal_send_huddle_message(- realm: Realm, sender: UserProfile, emails: List[str], content: str+ realm: Realm,+ sender: UserProfile,+ content: str,+ *,+ emails: Optional[List[str]] = None,+ recipient_users: Optional[List[UserProfile]] = None,) -> Optional[int]:- message = internal_prep_huddle_message(realm, sender, content, emails=emails)+ message = internal_prep_huddle_message(+ realm, sender, content, emails=emails, recipient_users=recipient_users+ )if message is None:return Nonediff --git a/zerver/lib/bot_lib.py b/zerver/lib/bot_lib.pyindex 6709888741e..cc0736a8ab7 100644--- a/zerver/lib/bot_lib.py+++ b/zerver/lib/bot_lib.py@@ -110,7 +110,7 @@ class EmbeddedBotHandler:)else:message_id = internal_send_huddle_message(- self.user_profile.realm, self.user_profile, recipients, message["content"]+ self.user_profile.realm, self.user_profile, message["content"], emails=recipients)return {"id": message_id}diff --git a/zerver/lib/email_mirror.py b/zerver/lib/email_mirror.pyindex 97e2260cdc5..b27e3b4cdfd 100644--- a/zerver/lib/email_mirror.py+++ b/zerver/lib/email_mirror.py@@ -454,7 +454,7 @@ def process_missed_message(to: str, message: EmailMessage) -> None:display_recipient = get_display_recipient(recipient)emails = [user_dict["email"] for user_dict in display_recipient]recipient_str = ", ".join(emails)- internal_send_huddle_message(user_profile.realm, user_profile, emails, body)+ internal_send_huddle_message(user_profile.realm, user_profile, body, emails=emails)else:raise AssertionError("Invalid recipient type!")diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex 3a2e4677eb7..6dba9ec00a3 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -1849,13 +1849,17 @@ class ScrubRealmTest(ZulipTestCase):notification_bot, get_stream("Scotland", zulip), "test", "test")internal_send_private_message(notification_bot, othello, "test")- internal_send_huddle_message(zulip, notification_bot, [othello.email, iago.email], "test")+ internal_send_huddle_message(+ zulip, notification_bot, "test", emails=[othello.email, iago.email]+ )internal_send_stream_message(notification_bot, get_stream("Shakespeare", lear), "test", "test")internal_send_private_message(notification_bot, king, "test")- internal_send_huddle_message(lear, notification_bot, [cordelia.email, king.email], "test")+ internal_send_huddle_message(+ lear, notification_bot, "test", emails=[cordelia.email, king.email]+ )Attachment.objects.filter(realm=zulip).delete()Attachment.objects.filter(realm=lear).delete()