Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
popovers: Refactor keyboard handling for starred messages popover.
Daniil Fadeev22561e2f3b67
diff --git a/web/src/hotkey.js b/web/src/hotkey.jsindex f5fa974daea..b7f59fcbcea 100644--- a/web/src/hotkey.js+++ b/web/src/hotkey.js@@ -372,11 +372,6 @@ function handle_popover_events(event_name) {return true;}- if (popover_menus.is_starred_messages_visible()) {- popover_menus.starred_messages_sidebar_menu_handle_keyboard(event_name);- return true;- }-if (popovers.user_info_manage_menu_popped()) {popovers.user_info_popover_manage_menu_handle_keyboard(event_name);return true;diff --git a/web/src/popover_menus.js b/web/src/popover_menus.jsindex c584df23401..a581bbd2901 100644--- a/web/src/popover_menus.js+++ b/web/src/popover_menus.js@@ -44,7 +44,6 @@ let message_actions_popover_displayed = false;let message_actions_popover_keyboard_toggle = false;let compose_control_buttons_popover_instance;-let starred_messages_popover_instance;const popover_instances = {compose_control_buttons: null,@@ -64,16 +63,12 @@ export function actions_popped() {return message_actions_popover_displayed;}-export function is_starred_messages_visible() {- return starred_messages_popover_instance?.state.isVisible;-}-export function get_compose_control_buttons_popover() {return compose_control_buttons_popover_instance;}export function get_starred_messages_popover() {- return starred_messages_popover_instance;+ return popover_instances.starred_messages;}function get_popover_items_for_instance(instance) {@@ -90,11 +85,6 @@ function get_popover_items_for_instance(instance) {return $current_elem.find("li:not(.divider):visible a");}-export function starred_messages_sidebar_menu_handle_keyboard(key) {- const items = get_popover_items_for_instance(starred_messages_popover_instance);- popovers.popover_items_handle_keyboard(key, items);-}-const default_popover_props = {delay: 0,appendTo: () => document.body,@@ -131,7 +121,7 @@ export function any_active() {compose_control_buttons_popover_instance ||compose_enter_sends_popover_displayed ||message_actions_popover_displayed ||- is_starred_messages_visible()+ get_visible_instance());}@@ -509,7 +499,7 @@ export function initialize() {...left_sidebar_tippy_options,onMount(instance) {const $popper = $(instance.popper);- starred_messages_popover_instance = instance;+ popover_instances.starred_messages = instance;$popper.one("click", "#unstar_all_messages", () => {starred_messages_ui.confirm_unstar_all_messages();@@ -542,7 +532,7 @@ export function initialize() {},onHidden(instance) {instance.destroy();- starred_messages_popover_instance = undefined;+ popover_instances.starred_messages = undefined;},});}diff --git a/web/tests/hotkey.test.js b/web/tests/hotkey.test.jsindex 907a5c11b82..d805f26a52e 100644--- a/web/tests/hotkey.test.js+++ b/web/tests/hotkey.test.js@@ -67,7 +67,6 @@ const popovers = mock_esm("../src/popovers", {const popover_menus = mock_esm("../src/popover_menus", {actions_popped: () => false,get_visible_instance: () => undefined,- is_starred_messages_visible: () => false,});const reactions = mock_esm("../src/reactions");const search = mock_esm("../src/search");