diff --git a/.eslintrc.json b/.eslintrc.json index e08e788bfa..ccf7daa2d8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -27,7 +27,6 @@ "popovers": false, "server_events": false, "ui": false, - "ui_state": false, "ui_report": false, "ui_util": false, "lightbox": false, diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index 476f94a41d..c521376f2e 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -178,10 +178,11 @@ function stubbing(func_name_to_stub, test_function) { _.each([return_true, return_false], function (is_settings_page) { _.each([return_true, return_false], function (is_active) { - _.each([return_true, return_false], function (is_info_overlay) { + _.each([return_true, return_false], function (info_overlay_open) { hotkey.is_settings_page = is_settings_page; - set_global('modals', {is_active: is_active}); - set_global('ui_state', {is_info_overlay: is_info_overlay}); + set_global('modals', { + is_active: is_active, + info_overlay_open: info_overlay_open}); test_normal_typing(); }); @@ -317,10 +318,10 @@ function stubbing(func_name_to_stub, test_function) { assert_mapping('spacebar', 'navigate.page_down'); assert_mapping('up_arrow', 'navigate.up'); - ui_state.is_info_overlay = return_true; + modals.info_overlay_open = return_true; assert_unmapped('down_arrow'); assert_unmapped('up_arrow'); - ui_state.is_info_overlay = return_false; + modals.info_overlay_open = return_false; hotkey.is_subs = return_true; assert_mapping('up_arrow', 'subs.switch_rows'); diff --git a/static/js/hotkey.js b/static/js/hotkey.js index c04b4949ff..a1653e147b 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -452,7 +452,7 @@ exports.process_hotkey = function (e, hotkey) { return reactions.reaction_navigate(e, event_name); } - if (ui_state.is_info_overlay()) { + if (modals.info_overlay_open()) { return false; } diff --git a/static/js/modals.js b/static/js/modals.js index 9247ded770..27571cf055 100644 --- a/static/js/modals.js +++ b/static/js/modals.js @@ -16,6 +16,10 @@ exports.is_active = function () { return !!open_modal_name; }; +exports.info_overlay_open = function () { + return open_modal_name === 'informationalOverlays'; +}; + exports.open_overlay = function (opts) { if (!opts.name || !opts.overlay || !opts.on_close) { blueslip.error('Programming error in open_modal'); diff --git a/static/js/ui_state.js b/static/js/ui_state.js deleted file mode 100644 index b92efe3ec9..0000000000 --- a/static/js/ui_state.js +++ /dev/null @@ -1,15 +0,0 @@ -var ui_state = (function () { - -var exports = {}; - -exports.is_info_overlay = function () { - return ($(".informational-overlays").hasClass("show")); -}; - -return exports; - -}()); - -if (typeof module !== 'undefined') { - module.exports = ui_state; -} diff --git a/zproject/settings.py b/zproject/settings.py index 72ed1332c2..9b2d7bb0c6 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -877,7 +877,6 @@ JS_SPECS = { 'js/list_rendering.js', 'js/floating_recipient_bar.js', 'js/lightbox.js', - 'js/ui_state.js', 'js/ui_report.js', 'js/ui.js', 'js/ui_util.js',