From 763437cc9ca7371559797eab9707691930e97b47 Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Mon, 2 Oct 2017 02:52:42 -0230 Subject: [PATCH] backend: Introduce check_send_private_message. check_send_private_message utilizes Addressee.for_user_profile() to send a private message to a user_profile. --- zerver/lib/actions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 10bed61e9b..8ee498715e 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1457,6 +1457,13 @@ def check_send_stream_message(sender, client, stream_name, topic, body): return do_send_messages([message])[0] +def check_send_private_message(sender, client, receiving_user, body): + # type: (UserProfile, Client, UserProfile, Text) -> int + addressee = Addressee.for_user_profile(receiving_user) + message = check_message(sender, client, addressee, body) + + return do_send_messages([message])[0] + # check_send_message: # Returns the id of the sent message. Has same argspec as check_message. def check_send_message(sender, client, message_type_name, message_to,