Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/alert_words_ui.js to ES6 module.
Anders Kaseorgac4d3bf20476
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 72a0ccdaf14..9218722db57 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -127,7 +127,6 @@"$": false,"activity": false,"admin": false,- "alert_words_ui": false,"attachments_ui": false,"avatar": false,"blueslip": false,diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.jsindex 2e50a9b2fcc..1815a096a1d 100644--- a/frontend_tests/node_tests/dispatch.js+++ b/frontend_tests/node_tests/dispatch.js@@ -21,7 +21,8 @@ const typing_person1 = events.typing_person1;set_global("setTimeout", (func) => func());const activity = set_global("activity", {});-const alert_words_ui = set_global("alert_words_ui", {});+const alert_words_ui = {__esModule: true};+rewiremock("../../static/js/alert_words_ui").with(alert_words_ui);const attachments_ui = set_global("attachments_ui", {});const bot_data = set_global("bot_data", {});rewiremock("../../static/js/compose").with({});diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.jsindex 4f3bf565997..1fb36a4baf1 100644--- a/static/js/alert_words_ui.js+++ b/static/js/alert_words_ui.js@@ -1,11 +1,9 @@-"use strict";+import render_alert_word_settings_item from "../templates/settings/alert_word_settings_item.hbs";-const render_alert_word_settings_item = require("../templates/settings/alert_word_settings_item.hbs");+import * as alert_words from "./alert_words";+import * as channel from "./channel";-const alert_words = require("./alert_words");-const channel = require("./channel");--exports.render_alert_words_ui = function () {+export function render_alert_words_ui() {const words = alert_words.get_word_list();words.sort();const word_list = $("#alert_words_list");@@ -21,7 +19,7 @@ exports.render_alert_words_ui = function () {// Focus new alert word name text box.$("#create_alert_word_name").trigger("focus");-};+}function update_alert_word_status(status_text, is_error) {const alert_word_status = $("#alert_word_status");@@ -77,10 +75,10 @@ function remove_alert_word(alert_word) {});}-exports.set_up_alert_words = function () {+export function set_up_alert_words() {// The settings page must be rendered before this function gets called.- exports.render_alert_words_ui();+ render_alert_words_ui();$("#create_alert_word_form").on("click", "#create_alert_word_button", () => {const word = $("#create_alert_word_name").val();@@ -108,6 +106,4 @@ exports.set_up_alert_words = function () {const alert = $(event.currentTarget).parents(".alert");alert.hide();});-};--window.alert_words_ui = exports;+}diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex 9c9643c8a87..3d7ea425239 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -30,7 +30,6 @@ import "../ui";import "../composebox_typeahead";import "../hotkey";import "../notifications";-import "../alert_words_ui";import "../attachments_ui";import "../message_store";import "../message_util";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex c6d504f3831..faa34edb9c2 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -5,7 +5,6 @@declare let activity: any;declare let admin: any;-declare let alert_words_ui: any;declare let attachments_ui: any;declare let avatar: any;declare let blueslip: any;diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.jsindex 122b6905492..2259c2a6664 100644--- a/static/js/server_events_dispatch.js+++ b/static/js/server_events_dispatch.js@@ -1,6 +1,7 @@import * as emoji from "../shared/js/emoji";import * as alert_words from "./alert_words";+import * as alert_words_ui from "./alert_words_ui";import * as compose from "./compose";import * as compose_fade from "./compose_fade";import * as markdown from "./markdown";diff --git a/static/js/settings_sections.js b/static/js/settings_sections.jsindex 7a190c9315c..6231ae9b1fe 100644--- a/static/js/settings_sections.js+++ b/static/js/settings_sections.js@@ -1,5 +1,6 @@"use strict";+const alert_words_ui = require("./alert_words_ui");const settings_muting = require("./settings_muting");const load_func_dict = new Map(); // group -> function