Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
echo: Pass transmit.send_message as a callback.
Anders Kaseorg339b1351f870
diff --git a/web/src/echo.js b/web/src/echo.jsindex 2d7b5869c97..8d903b805eb 100644--- a/web/src/echo.js+++ b/web/src/echo.js@@ -21,7 +21,6 @@ import * as sent_messages from "./sent_messages";import * as stream_data from "./stream_data";import * as stream_list from "./stream_list";import * as stream_topic_history from "./stream_topic_history";-import * as transmit from "./transmit";import * as util from "./util";// Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html@@ -73,7 +72,7 @@ function failed_message_success(message_id) {show_failed_message_success(message_id);}-function resend_message(message, $row, on_send_message_success) {+function resend_message(message, $row, {on_send_message_success, send_message}) {message.content = message.raw_content;if (show_retry_spinner($row)) {// retry already in in progress@@ -107,7 +106,7 @@ function resend_message(message, $row, on_send_message_success) {blueslip.log("Manual resend of message failed");}- transmit.send_message(message, on_success, on_error);+ send_message(message, on_success, on_error);}export function build_display_recipient(message) {@@ -474,7 +473,7 @@ export function display_slow_send_loading_spinner(message) {}}-export function initialize({on_send_message_success}) {+export function initialize({on_send_message_success, send_message}) {function on_failed_action(selector, callback) {$("#main_div").on("click", selector, function (e) {e.stopPropagation();@@ -490,7 +489,7 @@ export function initialize({on_send_message_success}) {);return;}- callback(message, $row, on_send_message_success);+ callback(message, $row, {on_send_message_success, send_message});});}diff --git a/web/src/ui_init.js b/web/src/ui_init.jsindex 838aee70086..f8f3aa7cf1f 100644--- a/web/src/ui_init.js+++ b/web/src/ui_init.js@@ -123,6 +123,7 @@ import * as tippyjs from "./tippyjs";import * as topic_list from "./topic_list";import * as topic_popover from "./topic_popover";import * as topic_zoom from "./topic_zoom";+import * as transmit from "./transmit";import * as tutorial from "./tutorial";import * as typeahead_helper from "./typeahead_helper";import * as typing from "./typing";@@ -597,7 +598,10 @@ export function initialize_everything() {navbar_alerts.initialize();message_list_hover.initialize();initialize_kitchen_sink_stuff();- echo.initialize({on_send_message_success: compose.send_message_success});+ echo.initialize({+ on_send_message_success: compose.send_message_success,+ send_message: transmit.send_message,+ });stream_edit.initialize();user_group_edit.initialize();stream_edit_subscribers.initialize();