diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 544a700d05..95755a7b16 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -18,6 +18,7 @@ import * as markdown from "./markdown"; import * as message_lists from "./message_lists"; import * as message_store from "./message_store"; import * as message_viewport from "./message_viewport"; +import * as overlays from "./overlays"; import {page_params} from "./page_params"; import * as resize from "./resize"; import * as rows from "./rows"; @@ -918,7 +919,7 @@ function hide_delete_btn_show_spinner(deleting) { export function delete_message(msg_id) { $("#delete-message-error").html(""); - $("#delete_message_modal").modal("show"); + overlays.open_modal("#delete_message_modal"); if (currently_deleting_messages.includes(msg_id)) { hide_delete_btn_show_spinner(true); } else { @@ -934,7 +935,7 @@ export function delete_message(msg_id) { channel.del({ url: "/json/messages/" + msg_id, success() { - $("#delete_message_modal").modal("hide"); + overlays.close_modal("#delete_message_modal"); currently_deleting_messages = currently_deleting_messages.filter( (id) => id !== msg_id, ); @@ -962,7 +963,7 @@ export function delete_topic(stream_id, topic_name) { topic_name, }, success() { - $("#delete_topic_modal").modal("hide"); + overlays.close_modal("#delete_topic_modal"); }, }); } @@ -988,7 +989,7 @@ export function move_topic_containing_message_to_stream( (id) => id !== message_id, ); hide_topic_move_spinner(); - $("#move_topic_modal").modal("hide"); + overlays.close_modal("#move_topic_modal"); } if (currently_topic_editing_messages.includes(message_id)) { hide_topic_move_spinner(); diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js index d07ef60572..fccf89ec32 100644 --- a/static/js/message_edit_history.js +++ b/static/js/message_edit_history.js @@ -5,6 +5,7 @@ import render_message_edit_history from "../templates/message_edit_history.hbs"; import * as channel from "./channel"; import {$t_html} from "./i18n"; +import * as overlays from "./overlays"; import * as people from "./people"; import * as timerender from "./timerender"; import * as ui_report from "./ui_report"; @@ -74,6 +75,6 @@ export function fetch_and_render_message_history(message) { export function show_history(message) { $("#message-history").html(""); - $("#message-edit-history").modal("show"); + overlays.open_modal("#message-edit-history"); fetch_and_render_message_history(message); } diff --git a/static/js/popovers.js b/static/js/popovers.js index dbdfea5559..c74528d7c2 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -369,7 +369,7 @@ export function hide_mobile_message_buttons_popover() { } export function hide_user_profile() { - $("#user-profile-modal").modal("hide"); + overlays.close_modal("#user-profile-modal"); } export function show_user_profile(user) { @@ -396,7 +396,7 @@ export function show_user_profile(user) { }; $("#user-profile-modal-holder").html(render_user_profile_modal(args)); - $("#user-profile-modal").modal("show"); + overlays.open_modal("#user-profile-modal"); settings_account.initialize_custom_user_type_fields( "#user-profile-modal #content", diff --git a/static/js/settings_account.js b/static/js/settings_account.js index 032e8dd209..070f849b2a 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -558,7 +558,7 @@ export function set_up() { // will not show up because of a call to `close_active_modal` in `settings.js`. e.preventDefault(); e.stopPropagation(); - $("#deactivate_self_modal").modal("show"); + overlays.open_modal("#deactivate_self_modal"); }); $("#account-settings").on("click", ".custom_user_field .remove_date", (e) => { @@ -598,7 +598,7 @@ export function set_up() { channel.del({ url: "/json/users/me", success() { - $("#deactivate_self_modal").modal("hide"); + overlays.close_modal("#deactivate_self_modal"); window.location.href = "/login/"; }, error(xhr) { @@ -623,7 +623,7 @@ export function set_up() { rendered_error_msg = error_last_user; } } - $("#deactivate_self_modal").modal("hide"); + overlays.close_modal("#deactivate_self_modal"); $("#account-settings-status") .addClass("alert-error") .html(rendered_error_msg) diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js index b6983a8aeb..1f985e3cc9 100644 --- a/static/js/stream_popover.js +++ b/static/js/stream_popover.js @@ -18,6 +18,7 @@ import {$t, $t_html} from "./i18n"; import * as message_edit from "./message_edit"; import * as muting from "./muting"; import * as muting_ui from "./muting_ui"; +import * as overlays from "./overlays"; import {page_params} from "./page_params"; import * as popovers from "./popovers"; import * as resize from "./resize"; @@ -363,7 +364,7 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) { ); stream_bar.decorate(current_stream_name, stream_header_colorblock, false); - $("#move_topic_modal").modal("show"); + overlays.open_modal("#move_topic_modal"); } export function register_click_handlers() { diff --git a/static/js/ui.js b/static/js/ui.js index da26ef0dc2..f20d645ac9 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -7,6 +7,7 @@ import {$t} from "./i18n"; import {localstorage} from "./localstorage"; import * as message_list from "./message_list"; import * as message_lists from "./message_lists"; +import * as overlays from "./overlays"; // What, if anything, obscures the home tab? @@ -144,7 +145,7 @@ export function maybe_show_deprecation_notice(key) { } if (!shown_deprecation_notices.includes(key)) { - $("#deprecation-notice-modal").modal("show"); + overlays.open_modal("#deprecation-notice-modal"); $("#deprecation-notice-message").text(message); $("#close-deprecation-notice").trigger("focus"); shown_deprecation_notices.push(key);