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.

open_modal: Pass extra arguments as object.

Ganesh Pawar6392a7122b89
diff --git a/static/js/deprecated_feature_notice.js b/static/js/deprecated_feature_notice.js
index 19406254056..09b87870f93 100644
--- a/static/js/deprecated_feature_notice.js
+++ b/static/js/deprecated_feature_notice.js
@@ -49,7 +49,7 @@ export function maybe_show_deprecation_notice(key) {
$(".app").append(deprecated_feature_notice);
- overlays.open_modal("#deprecation-notice-modal", true);
+ overlays.open_modal("#deprecation-notice-modal", {autoremove: true});
$("#deprecation-notice-message").text(message);
$("#close-deprecation-notice").trigger("focus");
shown_deprecation_notices.push(key);
diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js
index 04dbdc25391..eec0a6d5b9e 100644
--- a/static/js/message_edit_history.js
+++ b/static/js/message_edit_history.js
@@ -83,7 +83,7 @@ export function show_history(message) {
$("#message_feed_container").append(rendered_message_history);
fetch_and_render_message_history(message);
- overlays.open_modal("#message-edit-history", true);
+ overlays.open_modal("#message-edit-history", {autoremove: true});
}
export function initialize() {
diff --git a/static/js/overlays.js b/static/js/overlays.js
index 4e84c826cd2..0b91fc1f560 100644
--- a/static/js/overlays.js
+++ b/static/js/overlays.js
@@ -111,9 +111,9 @@ export function open_overlay(opts) {
};
}
-// If autoremove is true, the modal element will be removed from the DOM
+// If conf.autoremove is true, the modal element will be removed from the DOM
// once the modal is hidden.
-export function open_modal(selector, autoremove = false) {
+export function open_modal(selector, conf) {
if (selector === undefined) {
blueslip.error("Undefined selector was passed into open_modal");
return;
@@ -139,7 +139,7 @@ export function open_modal(selector, autoremove = false) {
elem.find(".alert").hide();
elem.find(".alert-notification").html("");
- if (autoremove) {
+ if (conf && conf.autoremove) {
elem.on("hidden.bs.modal", () => {
elem.remove();
});