modals: Use selectors for open_modal/close_modal.

When reading the calling code, it's helpful to know
that we're really just passing in a selector.  The
calls to open_modal/close_modal are nicer now to
reconcile with surrounding code, and you don't have
to guess whether the parameter is some kind of
"key" value--it really just refers directly to a DOM
element.

There is nothing user-visible about this change, but
the blueslip info messages now include the hash:

    open modal: open #change_email_modal
This commit is contained in:
Steve Howell
2020-05-09 13:45:54 +00:00
committed by Tim Abbott
parent d3aded2ae7
commit 2272c5e6eb
8 changed files with 47 additions and 40 deletions

View File

@@ -410,7 +410,7 @@ function change_stream_privacy(e) {
url: "/json/streams/" + stream_id,
data: data,
success: function () {
overlays.close_modal('stream_privacy_modal');
overlays.close_modal('#stream_privacy_modal');
$("#stream_privacy_modal").remove();
// The rest will be done by update stream event we will get.
},
@@ -529,7 +529,7 @@ exports.initialize = function () {
const change_privacy_modal = render_subscription_stream_privacy_modal(template_data);
$("#stream_privacy_modal").remove();
$("#subscriptions_table").append(change_privacy_modal);
overlays.open_modal('stream_privacy_modal');
overlays.open_modal('#stream_privacy_modal');
e.preventDefault();
e.stopPropagation();
});
@@ -665,12 +665,12 @@ exports.initialize = function () {
});
$("#deactivation_stream_modal").remove();
$("#subscriptions_table").append(deactivate_stream_modal);
overlays.open_modal('deactivation_stream_modal');
overlays.open_modal('#deactivation_stream_modal');
});
$("#subscriptions_table").on("click", "#do_deactivate_stream_button", function (e) {
const stream_id = $(e.target).data("stream-id");
overlays.close_modal('deactivation_stream_modal');
overlays.close_modal('#deactivation_stream_modal');
$("#deactivation_stream_modal").remove();
if (!stream_id) {
ui_report.message(i18n.t("Invalid stream id"), $(".stream_change_property_info"), 'alert-error');