Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
deprecated_feature_notice: Migrate modal to dialog_widget.
Ganesh Pawarfce3261c30c6
diff --git a/frontend_tests/node_tests/deprecated_feature_notice.js b/frontend_tests/node_tests/deprecated_feature_notice.jsindex 8a7413786ad..03cc32b3f05 100644--- a/frontend_tests/node_tests/deprecated_feature_notice.js+++ b/frontend_tests/node_tests/deprecated_feature_notice.js@@ -13,7 +13,7 @@ const deprecated_feature_notice = zrequire("deprecated_feature_notice");run_test("get_hotkey_deprecation_notice", () => {const expected =- 'translated: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';+ 'translated HTML: We\'ve replaced the "*" hotkey with "Ctrl + s" to make this common shortcut easier to trigger.';const actual = deprecated_feature_notice.get_hotkey_deprecation_notice("*", "Ctrl + s");assert.equal(actual, expected);});@@ -22,7 +22,7 @@ run_test("get_hotkey_deprecation_notice_mac", () => {navigator.userAgent ="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";const expected =- 'translated: We\'ve replaced the "*" hotkey with "Cmd + s" to make this common shortcut easier to trigger.';+ 'translated HTML: We\'ve replaced the "*" hotkey with "Cmd + s" to make this common shortcut easier to trigger.';const actual = deprecated_feature_notice.get_hotkey_deprecation_notice("*", "Cmd + s");assert.equal(actual, expected);// Reset userAgentdiff --git a/static/js/deprecated_feature_notice.js b/static/js/deprecated_feature_notice.jsindex 09b87870f93..4fc6f8aa417 100644--- a/static/js/deprecated_feature_notice.js+++ b/static/js/deprecated_feature_notice.js@@ -1,15 +1,11 @@-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";+import * as dialog_widget from "./dialog_widget";+import {$t_html} from "./i18n";import {localstorage} from "./localstorage";-import * as overlays from "./overlays";export function get_hotkey_deprecation_notice(originalHotkey, replacementHotkey) {- return $t(+ return $t_html({defaultMessage:'We\'ve replaced the "{originalHotkey}" hotkey with "{replacementHotkey}" to make this common shortcut easier to trigger.',@@ -44,14 +40,16 @@ 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);+ dialog_widget.launch({+ html_heading: $t_html({defaultMessage: "Deprecation notice"}),+ html_body: message,+ html_submit_button: $t_html({defaultMessage: "Got it"}),+ on_click: () => {},+ close_on_submit: true,+ focus_submit_on_open: true,+ single_footer_button: true,+ });- overlays.open_modal("#deprecation-notice-modal", {autoremove: true});- $("#deprecation-notice-message").text(message);- $("#close-deprecation-notice").trigger("focus");shown_deprecation_notices.push(key);if (localstorage.supported()) {localStorage.setItem(diff --git a/static/templates/deprecated_feature_notice.hbs b/static/templates/deprecated_feature_notice.hbsdeleted file mode 100644index 09116988446..00000000000--- a/static/templates/deprecated_feature_notice.hbs+++ /dev/null@@ -1,16 +0,0 @@-<div class="modal hide modal-bg new-style" id="deprecation-notice-modal" role="dialog"- aria-labelledby="deprecation-notice-label" aria-hidden="true">-- <div class="modal-header">- <button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">×</span></button>- <h3 id="deprecation-notice-label">{{t "Deprecation notice" }}</h3>- </div>-- <div class="modal-body">- <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">{{t "Got it" }}</button>- </div>-</div>