From c354d2245472949edfb6040b00eccce4dd7452d6 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 31 May 2023 17:02:28 -0700 Subject: [PATCH] echo: Cut dependency on compose.js. --- web/src/echo.js | 9 ++++----- web/src/ui_init.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web/src/echo.js b/web/src/echo.js index d85fd6df73..45bf5c523f 100644 --- a/web/src/echo.js +++ b/web/src/echo.js @@ -3,7 +3,6 @@ import $ from "jquery"; import * as alert_words from "./alert_words"; import {all_messages_data} from "./all_messages_data"; import * as blueslip from "./blueslip"; -import * as compose from "./compose"; import * as compose_ui from "./compose_ui"; import * as drafts from "./drafts"; import * as local_message from "./local_message"; @@ -82,7 +81,7 @@ function failed_message_success(message_id) { show_failed_message_success(message_id); } -function resend_message(message, $row) { +function resend_message(message, $row, on_send_message_success) { message.content = message.raw_content; if (show_retry_spinner($row)) { // retry already in in progress @@ -102,7 +101,7 @@ function resend_message(message, $row) { hide_retry_spinner($row); - compose.send_message_success(local_id, message_id, locally_echoed); + on_send_message_success(local_id, message_id, locally_echoed); // Resend succeeded, so mark as no longer failed failed_message_success(message_id); @@ -482,7 +481,7 @@ export function display_slow_send_loading_spinner(message) { } } -export function initialize() { +export function initialize({on_send_message_success}) { function on_failed_action(selector, callback) { $("#main_div").on("click", selector, function (e) { e.stopPropagation(); @@ -499,7 +498,7 @@ export function initialize() { ); return; } - callback(message, $row); + callback(message, $row, on_send_message_success); }); } diff --git a/web/src/ui_init.js b/web/src/ui_init.js index ce93f8f00a..2aa44edde1 100644 --- a/web/src/ui_init.js +++ b/web/src/ui_init.js @@ -664,7 +664,7 @@ export function initialize_everything() { message_viewport.initialize(); navbar_alerts.initialize(); initialize_kitchen_sink_stuff(); - echo.initialize(); + echo.initialize({on_send_message_success: compose.send_message_success}); stream_edit.initialize(); user_group_edit.initialize(); stream_edit_subscribers.initialize();