Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

js: Convert static/js/message_edit.js to ES6 module.

Anders Kaseorgdd18b32e040a
diff --git a/.eslintrc.json b/.eslintrc.json
index 5bc79590d7a..62142acbe4b 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -163,7 +163,6 @@
"ListWidget": false,
"localStorage": false,
"location": false,
- "message_edit": false,
"message_events": false,
"message_fetch": false,
"message_flags": false,
diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js
index fb17d90f900..0eae997bf95 100644
--- a/frontend_tests/node_tests/dispatch.js
+++ b/frontend_tests/node_tests/dispatch.js
@@ -32,7 +32,8 @@ set_global("home_msg_list", {});
const hotspots = set_global("hotspots", {});
const markdown = {__esModule: true};
rewiremock("../../static/js/markdown").with(markdown);
-const message_edit = set_global("message_edit", {});
+const message_edit = {__esModule: true};
+rewiremock("../../static/js/message_edit").with(message_edit);
const message_events = set_global("message_events", {});
const message_list = set_global("message_list", {});
const muting_ui = {__esModule: true};
diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js
index f0e7ba8bc5e..bda5374b04c 100644
--- a/frontend_tests/node_tests/hotkey.js
+++ b/frontend_tests/node_tests/hotkey.js
@@ -75,7 +75,8 @@ const hashchange = set_global("hashchange", {
set_global("info_overlay", {});
const lightbox = set_global("lightbox", {});
const list_util = set_global("list_util", {});
-const message_edit = set_global("message_edit", {});
+const message_edit = {__esModule: true};
+rewiremock("../../static/js/message_edit").with(message_edit);
const muting_ui = {__esModule: true};
rewiremock("../../static/js/muting_ui").with(muting_ui);
const narrow = set_global("narrow", {});
diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js
index 5a20e18a560..91f5b3a47a3 100644
--- a/frontend_tests/node_tests/message_events.js
+++ b/frontend_tests/node_tests/message_events.js
@@ -9,7 +9,8 @@ const {run_test} = require("../zjsunit/test");
const condense = set_global("condense", {});
set_global("current_msg_list", {});
-const message_edit = set_global("message_edit", {});
+const message_edit = {__esModule: true};
+rewiremock("../../static/js/message_edit").with(message_edit);
const message_list = set_global("message_list", {});
const notifications = set_global("notifications", {});
const page_params = set_global("page_params", {});
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js
index 2e8171292c9..8ea5d403195 100644
--- a/frontend_tests/node_tests/popovers.js
+++ b/frontend_tests/node_tests/popovers.js
@@ -238,7 +238,7 @@ test_ui("actions_popover", (override) => {
return message;
};
- message_edit.get_editability = () => 4;
+ message_edit.__Rewire__("get_editability", () => 4);
stream_data.id_to_slug = (stream_id) => {
assert.equal(stream_id, 123);
diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js
index df077abca2f..03a35c7104b 100644
--- a/static/js/bundles/app.js
+++ b/static/js/bundles/app.js
@@ -26,7 +26,6 @@ import "../narrow";
import "../reload";
import "../compose_actions";
import "../subs";
-import "../message_edit";
import "../condense";
import "../resize";
import "../list_widget";
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index b4075ed5036..0202096c2c4 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -11,6 +11,7 @@ const render_buddy_list_tooltip_content = require("../templates/buddy_list_toolt
const channel = require("./channel");
const compose = require("./compose");
const compose_state = require("./compose_state");
+const message_edit = require("./message_edit");
const message_edit_history = require("./message_edit_history");
const muting_ui = require("./muting_ui");
const rows = require("./rows");
diff --git a/static/js/global.d.ts b/static/js/global.d.ts
index d54bb3b2121..8d3d1684f84 100644
--- a/static/js/global.d.ts
+++ b/static/js/global.d.ts
@@ -37,7 +37,6 @@ declare let input_pill: any;
declare let lightbox: any;
declare let list_util: any;
declare let list_widget: any;
-declare let message_edit: any;
declare let message_events: any;
declare let message_fetch: any;
declare let message_flags: any;
diff --git a/static/js/hotkey.js b/static/js/hotkey.js
index ca5266b68da..8ffd7503c56 100644
--- a/static/js/hotkey.js
+++ b/static/js/hotkey.js
@@ -8,6 +8,7 @@ const compose_state = require("./compose_state");
const copy_and_paste = require("./copy_and_paste");
const drafts = require("./drafts");
const feedback_widget = require("./feedback_widget");
+const message_edit = require("./message_edit");
const muting_ui = require("./muting_ui");
const topic_zoom = require("./topic_zoom");
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index c123261415d..43c3466750f 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -1,19 +1,17 @@
-"use strict";
+import ClipboardJS from "clipboard";
-const ClipboardJS = require("clipboard");
+import render_message_edit_form from "../templates/message_edit_form.hbs";
+import render_topic_edit_form from "../templates/topic_edit_form.hbs";
-const render_message_edit_form = require("../templates/message_edit_form.hbs");
-const render_topic_edit_form = require("../templates/topic_edit_form.hbs");
-
-const channel = require("./channel");
-const compose = require("./compose");
-const echo = require("./echo");
-const loading = require("./loading");
-const markdown = require("./markdown");
-const message_viewport = require("./message_viewport");
-const rows = require("./rows");
-const stream_data = require("./stream_data");
-const upload = require("./upload");
+import * as channel from "./channel";
+import * as compose from "./compose";
+import * as echo from "./echo";
+import * as loading from "./loading";
+import * as markdown from "./markdown";
+import * as message_viewport from "./message_viewport";
+import * as rows from "./rows";
+import * as stream_data from "./stream_data";
+import * as upload from "./upload";
const currently_editing_messages = new Map();
let currently_deleting_messages = [];
@@ -23,10 +21,11 @@ const currently_echoing_messages = new Map();
// These variables are designed to preserve the user's most recent
// choices when editing a group of messages, to make it convenient to
// move several topics in a row with the same settings.
-exports.notify_old_thread_default = true;
-exports.notify_new_thread_default = true;
+export let notify_old_thread_default = true;
+
+export let notify_new_thread_default = true;
-const editability_types = {
+export const editability_types = {
NO: 1,
NO_LONGER: 2,
// Note: TOPIC_ONLY does not include stream messages with no topic sent
@@ -38,9 +37,8 @@ const editability_types = {
TOPIC_ONLY: 3,
FULL: 4,
};
-exports.editability_types = editability_types;
-function is_topic_editable(message, edit_limit_seconds_buffer = 0) {
+export function is_topic_editable(message, edit_limit_seconds_buffer = 0) {
if (!page_params.realm_allow_message_editing) {
// If message editing is disabled, so is topic editing.
return false;
@@ -67,7 +65,7 @@ function is_topic_editable(message, edit_limit_seconds_buffer = 0) {
);
}
-function get_editability(message, edit_limit_seconds_buffer = 0) {
+export function get_editability(message, edit_limit_seconds_buffer = 0) {
if (!message) {
return editability_types.NO;
}
@@ -117,10 +115,8 @@ function get_editability(message, edit_limit_seconds_buffer = 0) {
}
return editability_types.NO_LONGER;
}
-exports.get_editability = get_editability;
-exports.is_topic_editable = is_topic_editable;
-exports.get_deletability = function (message) {
+export function get_deletability(message) {
if (page_params.is_admin) {
return true;
}
@@ -149,68 +145,68 @@ exports.get_deletability = function (message) {
return true;
}
return false;
-};
+}
-exports.update_message_topic_editing_pencil = function () {
+export function update_message_topic_editing_pencil() {
if (page_params.realm_allow_message_editing) {
$(".on_hover_topic_edit, .always_visible_topic_edit").show();
} else {
$(".on_hover_topic_edit, .always_visible_topic_edit").hide();
}
-};
+}
-exports.hide_message_edit_spinner = function (row) {
+export function hide_message_edit_spinner(row) {
const spinner = row.find(".message_edit_spinner");
loading.destroy_indicator(spinner);
$("#message_edit_form .message_edit_save").show();
$("#message_edit_form .message_edit_cancel").show();
-};
+}
-exports.show_message_edit_spinner = function (row) {
+export function show_message_edit_spinner(row) {
const spinner = row.find(".message_edit_spinner");
loading.make_indicator(spinner);
$("#message_edit_form .message_edit_save").hide();
$("#message_edit_form .message_edit_cancel").hide();
-};
+}
-exports.show_topic_edit_spinner = function (row) {
+export function show_topic_edit_spinner(row) {
const spinner = row.find(".topic_edit_spinner");
loading.make_indicator(spinner);
spinner.css({height: ""});
$(".topic_edit_save").hide();
$(".topic_edit_cancel").hide();
$(".topic_edit_spinner").show();
-};
+}
-exports.hide_topic_move_spinner = function () {
+export function hide_topic_move_spinner() {
const spinner = $("#move_topic_modal .topic_move_spinner");
loading.destroy_indicator(spinner);
$("#move_topic_modal .modal-footer").show();
-};
+}
-exports.show_topic_move_spinner = function () {
+export function show_topic_move_spinner() {
const spinner = $("#move_topic_modal .topic_move_spinner");
loading.make_indicator(spinner);
$("#move_topic_modal .modal-footer").hide();
-};
+}
-exports.end_if_focused_on_inline_topic_edit = function () {
+export function end_if_focused_on_inline_topic_edit() {
const focused_elem = $(".topic_edit_form").find(":focus");
if (focused_elem.length === 1) {
focused_elem.trigger("blur");
const recipient_row = focused_elem.closest(".recipient_row");
- exports.end_inline_topic_edit(recipient_row);
+ end_inline_topic_edit(recipient_row);
}
-};
+}
-exports.end_if_focused_on_message_row_edit = function () {
+export function end_if_focused_on_message_row_edit() {
const focused_elem = $(".message_edit").find(":focus");
if (focused_elem.length === 1) {
focused_elem.trigger("blur");
const row = focused_elem.closest(".message_row");
- exports.end_message_row_edit(row);
+ end_message_row_edit(row);
}
-};
+}
function handle_message_row_edit_keydown(e) {
const code = e.keyCode || e.which;
@@ -229,7 +225,7 @@ function handle_message_row_edit_keydown(e) {
e.preventDefault();
return;
}
- exports.save_message_row_edit(row);
+ save_message_row_edit(row);
e.stopPropagation();
e.preventDefault();
} else {
@@ -241,13 +237,13 @@ function handle_message_row_edit_keydown(e) {
$(e.target).hasClass("message_edit_topic_propagate")
) {
const row = $(e.target).closest(".message_row");
- exports.save_message_row_edit(row);
+ save_message_row_edit(row);
e.stopPropagation();
e.preventDefault();
}
return;
case 27: // Handle escape keys in the message_edit form.
- exports.end_if_focused_on_message_row_edit();
+ end_if_focused_on_message_row_edit();
e.stopPropagation();
e.preventDefault();
return;
@@ -262,12 +258,12 @@ function handle_inline_topic_edit_keydown(e) {
switch (code) {
case 13: // Handle Enter key in the recipient bar/inline topic edit form
row = $(e.target).closest(".recipient_row");
- exports.save_inline_topic_edit(row);
+ save_inline_topic_edit(row);
e.stopPropagation();
e.preventDefault();
return;
case 27: // handle Esc
- exports.end_if_focused_on_inline_topic_edit();
+ end_if_focused_on_inline_topic_edit();
e.stopPropagation();
e.preventDefault();
return;
@@ -305,8 +301,7 @@ function edit_message(row, raw_content) {
const seconds_left_buffer = 5;
const editability = get_editability(message, seconds_left_buffer);
const is_editable =
- editability === exports.editability_types.TOPIC_ONLY ||
- editability === exports.editability_types.FULL;
+ editability === editability_types.TOPIC_ONLY || editability === editability_types.FULL;
const max_file_upload_size = page_params.max_file_upload_size_mib;
let file_upload_enabled = false;
@@ -327,7 +322,7 @@ function edit_message(row, raw_content) {
is_stream: message.type === "stream",
message_id: message.id,
is_editable,
- is_content_editable: editability === exports.editability_types.FULL,
+ is_content_editable: editability === editability_types.FULL,
has_been_editable: editability !== editability_types.NO,
topic: message.topic,
content: raw_content,
@@ -338,8 +333,8 @@ function edit_message(row, raw_content) {
available_streams,
stream_id: message.stream_id,
stream_name: message.stream,
- notify_new_thread: exports.notify_new_thread_default,
- notify_old_thread: exports.notify_old_thread_default,
+ notify_new_thread: notify_new_thread_default,
+ notify_old_thread: notify_old_thread_default,
}),
);
@@ -524,7 +519,7 @@ function start_edit_with_content(row, content, edit_box_open_callback) {
});
}
-exports.start = function (row, edit_box_open_callback) {
+export function start(row, edit_box_open_callback) {
const message = current_msg_list.get(rows.id(row));
if (message === undefined) {
blueslip.error("Couldn't find message ID for edit " + rows.id(row));
@@ -547,9 +542,9 @@ exports.start = function (row, edit_box_open_callback) {
}
},
});
-};
+}
-exports.start_topic_edit = function (recipient_row) {
+export function start_topic_edit(recipient_row) {
const form = $(render_topic_edit_form());
current_msg_list.show_edit_topic_on_recipient_row(recipient_row, form);
form.on("keydown", handle_inline_topic_edit_keydown);
@@ -561,17 +556,17 @@ exports.start_topic_edit = function (recipient_row) {
topic = "";
}
form.find(".inline_topic_edit").val(topic).trigger("select").trigger("focus");
-};
+}
-exports.is_editing = function (id) {
+export function is_editing(id) {
return currently_editing_messages.has(id);
-};
+}
-exports.end_inline_topic_edit = function (row) {
+export function end_inline_topic_edit(row) {
current_msg_list.hide_edit_topic_on_recipient_row(row);
-};
+}
-exports.end_message_row_edit = function (row) {
+export function end_message_row_edit(row) {
const message = current_msg_list.get(rows.id(row));
if (message !== undefined && currently_editing_messages.has(message.id)) {
const scroll_by = currently_editing_messages.get(message.id).scrolled_by;
@@ -597,9 +592,9 @@ exports.end_message_row_edit = function (row) {
// We have to blur out text fields, or else hotkeys.js
// thinks we are still editing.
row.find(".message_edit").trigger("blur");
-};
+}
-exports.save_inline_topic_edit = function (row) {
+export function save_inline_topic_edit(row) {
const msg_list = current_msg_list;
let message_id = rows.id_for_recipient_row(row);
const message = current_msg_list.get(message_id);
@@ -611,18 +606,18 @@ exports.save_inline_topic_edit = function (row) {
if (!topic_changed) {
// this means the inline_topic_edit was opened and submitted without
// changing anything, therefore, we should just close the inline topic edit.
- exports.end_inline_topic_edit(row);
+ end_inline_topic_edit(row);
return;
}
- exports.show_topic_edit_spinner(row);
+ show_topic_edit_spinner(row);
if (message.locally_echoed) {
if (topic_changed) {
echo.edit_locally(message, {new_topic});
row = current_msg_list.get_row(message_id);
}
- exports.end_inline_topic_edit(row);
+ end_inline_topic_edit(row);
return;
}
@@ -649,9 +644,9 @@ exports.save_inline_topic_edit = function (row) {
}
},
});
-};
+}
-exports.save_message_row_edit = function (row) {
+export function save_message_row_edit(row) {
const msg_list = current_msg_list;
let message_id = rows.id(row);
const message = current_msg_list.get(message_id);
@@ -667,7 +662,7 @@ exports.save_message_row_edit = function (row) {
let new_stream_id;
const old_stream_id = message.stream_id;
- exports.show_message_edit_spinner(row);
+ show_message_edit_spinner(row);
if (message.type === "stream") {
new_topic = row.find(".message_edit_topic").val();
@@ -688,7 +683,7 @@ exports.save_message_row_edit = function (row) {
});
row = current_msg_list.get_row(message_id);
}
- exports.end_message_row_edit(row);
+ end_message_row_edit(row);
return;
}
@@ -706,8 +701,8 @@ exports.save_message_row_edit = function (row) {
request.propagate_mode = selected_topic_propagation;
request.send_notification_to_old_thread = send_notification_to_old_thread;
request.send_notification_to_new_thread = send_notification_to_new_thread;
- exports.notify_old_thread_default = send_notification_to_old_thread;
- exports.notify_new_thread_default = send_notification_to_new_thread;
+ notify_old_thread_default = send_notification_to_old_thread;
+ notify_new_thread_default = send_notification_to_new_thread;
changed = true;
}
@@ -724,7 +719,7 @@ exports.save_message_row_edit = function (row) {
if (!changed) {
// If they didn't change anything, just cancel it.
- exports.end_message_row_edit(row);
+ end_message_row_edit(row);
return;
}
@@ -766,7 +761,7 @@ exports.save_message_row_edit = function (row) {
echo.edit_locally(message, currently_echoing_messages.get(message_id));
row = current_msg_list.get_row(message_id);
- exports.end_message_row_edit(row);
+ end_message_row_edit(row);
}
channel.patch({
@@ -777,7 +772,7 @@ exports.save_message_row_edit = function (row) {
delete message.local_edit_timestamp;
currently_echoing_messages.delete(message_id);
}
- exports.hide_message_edit_spinner(row);
+ hide_message_edit_spinner(row);
},
error(xhr) {
if (msg_list === current_msg_list) {
@@ -800,28 +795,28 @@ exports.save_message_row_edit = function (row) {
});
row = current_msg_list.get_row(message_id);
- if (!exports.is_editing(message_id)) {
+ if (!is_editing(message_id)) {
// Return to the message editing open UI state.
start_edit_maintaining_scroll(row, echo_data.orig_raw_content);
}
}
- exports.hide_message_edit_spinner(row);
+ hide_message_edit_spinner(row);
const message = channel.xhr_error_message(i18n.t("Error saving edit"), xhr);
row.find(".edit_error").text(message).show();
}
},
});
// The message will automatically get replaced via message_list.update_message.
-};
+}
-exports.maybe_show_edit = function (row, id) {
+export function maybe_show_edit(row, id) {
if (currently_editing_messages.has(id)) {
current_msg_list.show_edit_message(row, currently_editing_messages.get(id));
}
-};
+}
-exports.edit_last_sent_message = function () {
+export function edit_last_sent_message() {
const msg = current_msg_list.get_last_message_sent_by_me();
if (!msg) {
@@ -833,7 +828,7 @@ exports.edit_last_sent_message = function () {
return;
}
- const msg_editability_type = exports.get_editability(msg, 5);
+ const msg_editability_type = get_editability(msg, 5);
if (msg_editability_type !== editability_types.FULL) {
return;
}
@@ -850,10 +845,10 @@ exports.edit_last_sent_message = function () {
// Finally do the real work!
compose_actions.cancel();
- exports.start(msg_row, () => {
+ start(msg_row, () => {
$("#message_edit_content").trigger("focus");
});
-};
+}
function hide_delete_btn_show_spinner(deleting) {
if (deleting) {
@@ -868,7 +863,7 @@ function hide_delete_btn_show_spinner(deleting) {
}
}
-exports.delete_message = function (msg_id) {
+export function delete_message(msg_id) {
$("#delete-message-error").html("");
$("#delete_message_modal").modal("show");
if (currently_deleting_messages.includes(msg_id)) {
@@ -905,9 +900,9 @@ exports.delete_message = function (msg_id) {
},
});
});
-};
+}
-exports.delete_topic = function (stream_id, topic_name) {
+export function delete_topic(stream_id, topic_name) {
channel.post({
url: "/json/streams/" + stream_id + "/delete_topic",
data: {
@@ -917,18 +912,18 @@ exports.delete_topic = function (stream_id, topic_name) {
$("#delete_topic_modal").modal("hide");
},
});
-};
+}
-exports.handle_narrow_deactivated = function () {
+export function handle_narrow_deactivated() {
for (const [idx, elem] of currently_editing_messages) {
if (current_msg_list.get(idx) !== undefined) {
const row = current_msg_list.get_row(idx);
current_msg_list.show_edit_message(row, elem);
}
}
-};
+}
-exports.move_topic_containing_message_to_stream = function (
+export function move_topic_containing_message_to_stream(
message_id,
new_stream_id,
new_topic_name,
@@ -939,11 +934,11 @@ exports.move_topic_containing_message_to_stream = function (
currently_topic_editing_messages = currently_topic_editing_messages.filter(
(id) => id !== message_id,
);
- exports.hide_topic_move_spinner();
+ hide_topic_move_spinner();
$("#move_topic_modal").modal("hide");
}
if (currently_topic_editing_messages.includes(message_id)) {
- exports.hide_topic_move_spinner();
+ hide_topic_move_spinner();
$("#topic_stream_edit_form_error .error-msg").text(
i18n.t("A Topic Move already in progress."),
);
@@ -959,8 +954,8 @@ exports.move_topic_containing_message_to_stream = function (
send_notification_to_old_thread,
send_notification_to_new_thread,
};
- exports.notify_old_thread_default = send_notification_to_old_thread;
- exports.notify_new_thread_default = send_notification_to_new_thread;
+ notify_old_thread_default = send_notification_to_old_thread;
+ notify_new_thread_default = send_notification_to_new_thread;
channel.patch({
url: "/json/messages/" + message_id,
data: request,
@@ -974,6 +969,4 @@ exports.move_topic_containing_message_to_stream = function (
ui_report.error(i18n.t("Error moving the topic"), xhr, $("#home-error"), 4000);
},
});
-};
-
-window.message_edit = exports;
+}
diff --git a/static/js/message_events.js b/static/js/message_events.js
index 674d0b6d845..9d5fdeae8c0 100644
--- a/static/js/message_events.js
+++ b/static/js/message_events.js
@@ -5,6 +5,7 @@ const channel = require("./channel");
const compose_fade = require("./compose_fade");
const compose_state = require("./compose_state");
const huddle_data = require("./huddle_data");
+const message_edit = require("./message_edit");
const message_edit_history = require("./message_edit_history");
const narrow_state = require("./narrow_state");
const pm_list = require("./pm_list");
diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js
index 2eb02018587..f4cf64a32bc 100644
--- a/static/js/message_list_view.js
+++ b/static/js/message_list_view.js
@@ -8,6 +8,7 @@ import render_single_message from "../templates/single_message.hbs";
import * as compose from "./compose";
import * as compose_fade from "./compose_fade";
+import * as message_edit from "./message_edit";
import * as message_viewport from "./message_viewport";
import * as narrow_state from "./narrow_state";
import * as people from "./people";
diff --git a/static/js/narrow.js b/static/js/narrow.js
index 706d1664306..0f9e78512bf 100644
--- a/static/js/narrow.js
+++ b/static/js/narrow.js
@@ -5,6 +5,7 @@ const compose = require("./compose");
const compose_fade = require("./compose_fade");
const compose_state = require("./compose_state");
const {Filter} = require("./filter");
+const message_edit = require("./message_edit");
const {MessageListData} = require("./message_list_data");
const narrow_state = require("./narrow_state");
const people = require("./people");
diff --git a/static/js/popovers.js b/static/js/popovers.js
index 09ffcd48b85..570d84a1015 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -18,6 +18,7 @@ const render_user_profile_modal = require("../templates/user_profile_modal.hbs")
const compose_state = require("./compose_state");
const feature_flags = require("./feature_flags");
+const message_edit = require("./message_edit");
const message_edit_history = require("./message_edit_history");
const message_viewport = require("./message_viewport");
const muting = require("./muting");
diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js
index a8f986ab1b9..cd46acd8318 100644
--- a/static/js/server_events_dispatch.js
+++ b/static/js/server_events_dispatch.js
@@ -4,6 +4,7 @@ import * as alert_words from "./alert_words";
import * as compose from "./compose";
import * as compose_fade from "./compose_fade";
import * as markdown from "./markdown";
+import * as message_edit from "./message_edit";
import * as muting_ui from "./muting_ui";
import * as narrow_state from "./narrow_state";
import * as peer_data from "./peer_data";
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 00683572f7e..0bf3ea5d458 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -9,6 +9,7 @@ const render_topic_sidebar_actions = require("../templates/topic_sidebar_actions
const render_unstar_messages_modal = require("../templates/unstar_messages_modal.hbs");
const channel = require("./channel");
+const message_edit = require("./message_edit");
const muting = require("./muting");
const muting_ui = require("./muting_ui");
const stream_color = require("./stream_color");
diff --git a/static/js/ui_init.js b/static/js/ui_init.js
index 1bdc233ef53..028b8ac198e 100644
--- a/static/js/ui_init.js
+++ b/static/js/ui_init.js
@@ -18,6 +18,7 @@ const emojisets = require("./emojisets");
const invite = require("./invite");
const markdown = require("./markdown");
const markdown_config = require("./markdown_config");
+const message_edit = require("./message_edit");
const message_viewport = require("./message_viewport");
const muting = require("./muting");
const people = require("./people");