diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 71c7429ff6..6398f56345 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -638,28 +638,6 @@ export function initialize() { $("#nonexistent_stream_reply_error").stop(true).fadeOut(500); }); - $("body").on("click", ".compose_stream_button", () => { - popovers.hide_mobile_message_buttons_popover(); - compose_actions.start("stream", {trigger: "new topic button"}); - }); - $("body").on("click", ".compose_private_button", () => { - popovers.hide_mobile_message_buttons_popover(); - compose_actions.start("private"); - }); - - $("body").on("click", ".compose_mobile_stream_button", () => { - popovers.hide_mobile_message_buttons_popover(); - compose_actions.start("stream", {trigger: "new topic button"}); - }); - $("body").on("click", ".compose_mobile_private_button", () => { - popovers.hide_mobile_message_buttons_popover(); - compose_actions.start("private"); - }); - - $("body").on("click", ".compose_reply_button", () => { - compose_actions.respond_to_message({trigger: "reply button"}); - }); - $("body").on("click", ".empty_feed_compose_stream", (e) => { compose_actions.start("stream", {trigger: "empty feed message"}); e.preventDefault(); diff --git a/static/js/compose_closed_ui.js b/static/js/compose_closed_ui.js index 038781b522..f0ba9ef3b7 100644 --- a/static/js/compose_closed_ui.js +++ b/static/js/compose_closed_ui.js @@ -1,6 +1,8 @@ import $ from "jquery"; +import * as compose_actions from "./compose_actions"; import * as message_lists from "./message_lists"; +import * as popovers from "./popovers"; function update_reply_recipient_label() { const message = message_lists.current.selected_message(); @@ -15,11 +17,34 @@ function update_reply_recipient_label() { $(".compose_reply_button_recipient_label").text(recipient_label); } -// TODO: Move the closed-compose buttons click handlers here, probably. - export function initialize() { // When the message selection changes, change the label on the Reply button. $(document).on("message_selected.zulip", () => { update_reply_recipient_label(); }); + + // Click handlers for buttons in the compose compose box. + $("body").on("click", ".compose_stream_button", () => { + popovers.hide_mobile_message_buttons_popover(); + compose_actions.start("stream", {trigger: "new topic button"}); + }); + + $("body").on("click", ".compose_private_button", () => { + popovers.hide_mobile_message_buttons_popover(); + compose_actions.start("private"); + }); + + $("body").on("click", ".compose_mobile_stream_button", () => { + popovers.hide_mobile_message_buttons_popover(); + compose_actions.start("stream", {trigger: "new topic button"}); + }); + + $("body").on("click", ".compose_mobile_private_button", () => { + popovers.hide_mobile_message_buttons_popover(); + compose_actions.start("private"); + }); + + $("body").on("click", ".compose_reply_button", () => { + compose_actions.respond_to_message({trigger: "reply button"}); + }); } diff --git a/tools/test-js-with-node b/tools/test-js-with-node index d0d9249c5a..ddb0c62df6 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -46,6 +46,7 @@ EXEMPT_FILES = { "static/js/blueslip_stacktrace.ts", "static/js/click_handlers.js", "static/js/compose_actions.js", + "static/js/compose_closed_ui.js", "static/js/composebox_typeahead.js", "static/js/compose_fade.js", "static/js/compose.js",