From 2b14714e3bcb2863a3fabf9ca6e84218cf4cc98e Mon Sep 17 00:00:00 2001 From: Aditya Bansal Date: Thu, 6 Jul 2017 23:20:52 +0530 Subject: [PATCH] compose.js: Export send_message(). We do this in order to have the definition of send_message() accessible to the outside world. This will help in testing this function. --- static/js/compose.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/compose.js b/static/js/compose.js index b0922c2ef0..c9f48604b5 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -313,7 +313,7 @@ exports.transmit_message = function (request, success, error) { } }; -function send_message(request) { +exports.send_message = function send_message(request) { if (request === undefined) { request = create_message_object(); } @@ -356,13 +356,13 @@ function send_message(request) { if (locally_echoed) { clear_compose_box(); } -} +}; exports.enter_with_preview_open = function () { exports.clear_preview_area(); if (page_params.enter_sends) { // If enter_sends is enabled, we just send the message - send_message(); + exports.send_message(); } else { // Otherwise, we return to the compose box and focus it $("#new_message_content").focus(); @@ -384,7 +384,7 @@ exports.test_send_many_messages = function (stream, subject, count) { message.subject = subject; message.content = num_sent.toString(); - send_message(message); + exports.send_message(message); if (num_sent === count) { return; @@ -402,7 +402,7 @@ exports.finish = function () { if (! compose.validate()) { return false; } - send_message(); + exports.send_message(); exports.clear_preview_area(); // TODO: Do we want to fire the event even if the send failed due // to a server-side error?