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.

deprecated_feature_notice: Migrate to handlebars.

Ganesh Pawar5e4b1e1867b4
diff --git a/static/js/deprecated_feature_notice.js b/static/js/deprecated_feature_notice.js
index f4359e80d92..8adc64009ef 100644
--- a/static/js/deprecated_feature_notice.js
+++ b/static/js/deprecated_feature_notice.js
@@ -1,5 +1,7 @@
import $ from "jquery";
+import render_deprecated_feature_notice from "../templates/deprecated_feature_notice.hbs";
+
import * as blueslip from "./blueslip";
import * as common from "./common";
import {$t} from "./i18n";
@@ -42,6 +44,11 @@ export function maybe_show_deprecation_notice(key) {
}
if (!shown_deprecation_notices.includes(key)) {
+ const rendered_deprecated_feature_notice = render_deprecated_feature_notice({message});
+ const deprecated_feature_notice = $(rendered_deprecated_feature_notice);
+
+ $(".app").append(deprecated_feature_notice);
+
overlays.open_modal("#deprecation-notice-modal");
$("#deprecation-notice-message").text(message);
$("#close-deprecation-notice").trigger("focus");
@@ -52,5 +59,9 @@ export function maybe_show_deprecation_notice(key) {
JSON.stringify(shown_deprecation_notices),
);
}
+
+ deprecated_feature_notice.on("hidden.bs.modal", () => {
+ deprecated_feature_notice.remove();
+ });
}
}
diff --git a/templates/zerver/app/deprecation_notice.html b/static/templates/deprecated_feature_notice.hbs
similarity index 59%
rename from templates/zerver/app/deprecation_notice.html
rename to static/templates/deprecated_feature_notice.hbs
index 5a34045e98c..09116988446 100644
--- a/templates/zerver/app/deprecation_notice.html
+++ b/static/templates/deprecated_feature_notice.hbs
@@ -2,15 +2,15 @@
aria-labelledby="deprecation-notice-label" aria-hidden="true">
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>
- <h3 id="deprecation-notice-label">{{ _('Deprecation notice') }}</h3>
+ <button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
+ <h3 id="deprecation-notice-label">{{t "Deprecation notice" }}</h3>
</div>
<div class="modal-body">
- <p id="deprecation-notice-message"></p>
+ <p id="deprecation-notice-message">{{message}}</p>
</div>
<div class="modal-footer">
- <button type="button" class="button rounded" id="close-deprecation-notice" data-dismiss="modal">{{ _("Got it") }}</button>
+ <button type="button" class="button rounded" id="close-deprecation-notice" data-dismiss="modal">{{t "Got it" }}</button>
</div>
</div>
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index 4e5d9527bde..228ea2019fb 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -149,7 +149,6 @@
<form id="logout_form" action="/accounts/logout/" method="POST">{{ csrf_input }}
</form>
</div>
- {% include "zerver/app/deprecation_notice.html" %}
<div id="user-profile-modal-holder"></div>
<div id="delete-topic-modal-holder"></div>
<div class="left-sidebar-modal-holder"></div>
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 6823ef867ef..ade291d8069 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -56,6 +56,7 @@ EXEMPT_FILES = {
"static/js/csrf.js",
"static/js/css_variables.js",
"static/js/debug.js",
+ "static/js/deprecated_feature_notice.js",
"static/js/desktop_integration.js",
"static/js/drafts.js",
"static/js/echo.js",