Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Convert static/js/list_util.js to ES6 module.
Anders Kaseorg9d7917749ca6
diff --git a/.eslintrc.json b/.eslintrc.jsonindex d0b04cac860..964796e2a03 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -153,7 +153,6 @@"i18n": false,"input_pill": false,"jQuery": false,- "list_util": false,"localStorage": false,"location": false,"message_events": false,diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.jsindex 78376ae6371..efda75e9fb4 100644--- a/frontend_tests/node_tests/hotkey.js+++ b/frontend_tests/node_tests/hotkey.js@@ -84,7 +84,8 @@ const hashchange = set_global("hashchange", {rewiremock("../../static/js/info_overlay").with({});const lightbox = {__esModule: true};rewiremock("../../static/js/lightbox").with(lightbox);-const list_util = set_global("list_util", {});+const list_util = {__esModule: true};+rewiremock("../../static/js/list_util").with(list_util);const message_edit = {__esModule: true};rewiremock("../../static/js/message_edit").with(message_edit);const muting_ui = {__esModule: true};diff --git a/static/js/bundles/app.js b/static/js/bundles/app.jsindex d45c3259c2a..953a7a8bdec 100644--- a/static/js/bundles/app.js+++ b/static/js/bundles/app.js@@ -28,7 +28,6 @@ import "../compose_actions";import "../subs";import "../ui";import "../composebox_typeahead";-import "../list_util";import "../hotkey";import "../notifications";import "../hash_util";diff --git a/static/js/global.d.ts b/static/js/global.d.tsindex 05fb95f7504..9f7c9f8f2c3 100644--- a/static/js/global.d.ts+++ b/static/js/global.d.ts@@ -29,7 +29,6 @@ declare let hotkey: any;declare let hotspots: any;declare let i18n: any;declare let input_pill: any;-declare let list_util: any;declare let message_events: any;declare let message_fetch: any;declare let message_flags: any;diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex d47eecb259b..679227469aa 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -11,6 +11,7 @@ const drafts = require("./drafts");const feedback_widget = require("./feedback_widget");const gear_menu = require("./gear_menu");const lightbox = require("./lightbox");+const list_util = require("./list_util");const message_edit = require("./message_edit");const muting_ui = require("./muting_ui");const navigate = require("./navigate");diff --git a/static/js/list_util.js b/static/js/list_util.jsindex e82b7d08389..398d80ba587 100644--- a/static/js/list_util.js+++ b/static/js/list_util.js@@ -1,21 +1,17 @@-"use strict";-const list_selectors = ["#stream_filters", "#global_filters", "#user_presences"];-exports.inside_list = function (e) {+export function inside_list(e) {const $target = $(e.target);const in_list = $target.closest(list_selectors.join(", ")).length > 0;return in_list;-};+}-exports.go_down = function (e) {+export function go_down(e) {const $target = $(e.target);$target.closest("li").next().find("a").trigger("focus");-};+}-exports.go_up = function (e) {+export function go_up(e) {const $target = $(e.target);$target.closest("li").prev().find("a").trigger("focus");-};--window.list_util = exports;+}