mirror of https://github.com/zulip/zulip.git
emoji_picker: Rename reactions_popped to is_open.
emoji_picker.is_open() much more accurately describes what this does, and in particular the fact that the function applies to all places the emoji picker might be.
This commit is contained in:
parent
82ca794f94
commit
6d3d9165b1
|
@ -187,12 +187,12 @@ function refill_section_head_offsets($popover) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reactions_popped() {
|
export function is_open() {
|
||||||
return Boolean(emoji_popover_instance);
|
return Boolean(emoji_popover_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hide_emoji_popover() {
|
export function hide_emoji_popover() {
|
||||||
if (!reactions_popped()) {
|
if (!is_open()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
current_message_id = null;
|
current_message_id = null;
|
||||||
|
@ -447,7 +447,7 @@ function change_focus_to_filter() {
|
||||||
export function navigate(event_name, e) {
|
export function navigate(event_name, e) {
|
||||||
if (
|
if (
|
||||||
event_name === "toggle_reactions_popover" &&
|
event_name === "toggle_reactions_popover" &&
|
||||||
reactions_popped() &&
|
is_open() &&
|
||||||
(search_is_active === false || search_results.length === 0)
|
(search_is_active === false || search_results.length === 0)
|
||||||
) {
|
) {
|
||||||
hide_emoji_popover();
|
hide_emoji_popover();
|
||||||
|
@ -792,7 +792,7 @@ export function register_click_handlers() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
toggle_emoji_popover(e.target, undefined, {placement: "bottom"});
|
toggle_emoji_popover(e.target, undefined, {placement: "bottom"});
|
||||||
if (reactions_popped()) {
|
if (is_open()) {
|
||||||
// Because the emoji picker gets drawn on top of the user
|
// Because the emoji picker gets drawn on top of the user
|
||||||
// status modal, we need this hack to make clicking outside
|
// status modal, we need this hack to make clicking outside
|
||||||
// the emoji picker only close the emoji picker, and not the
|
// the emoji picker only close the emoji picker, and not the
|
||||||
|
|
|
@ -292,7 +292,7 @@ export function process_escape_key(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emoji picker goes before compose so compose emoji picker is closed properly.
|
// Emoji picker goes before compose so compose emoji picker is closed properly.
|
||||||
if (emoji_picker.reactions_popped()) {
|
if (emoji_picker.is_open()) {
|
||||||
emoji_picker.hide_emoji_popover();
|
emoji_picker.hide_emoji_popover();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ export function process_enter_key(e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emoji_picker.reactions_popped()) {
|
if (emoji_picker.is_open()) {
|
||||||
return emoji_picker.navigate("enter", e);
|
return emoji_picker.navigate("enter", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ export function process_tab_key() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emoji_picker.reactions_popped()) {
|
if (emoji_picker.is_open()) {
|
||||||
return emoji_picker.navigate("tab");
|
return emoji_picker.navigate("tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ export function process_shift_tab_key() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift-Tabbing from emoji catalog/search results takes you back to search textbox.
|
// Shift-Tabbing from emoji catalog/search results takes you back to search textbox.
|
||||||
if (emoji_picker.reactions_popped()) {
|
if (emoji_picker.is_open()) {
|
||||||
return emoji_picker.navigate("shift_tab");
|
return emoji_picker.navigate("shift_tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@ export function process_hotkey(e, hotkey) {
|
||||||
|
|
||||||
// This block needs to be before the open modals check, because
|
// This block needs to be before the open modals check, because
|
||||||
// the "user status" modal can show the emoji picker.
|
// the "user status" modal can show the emoji picker.
|
||||||
if (emoji_picker.reactions_popped()) {
|
if (emoji_picker.is_open()) {
|
||||||
return emoji_picker.navigate(event_name);
|
return emoji_picker.navigate(event_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1070,7 +1070,7 @@ export function any_active() {
|
||||||
stream_popover.stream_popped() ||
|
stream_popover.stream_popped() ||
|
||||||
message_info_popped() ||
|
message_info_popped() ||
|
||||||
user_info_popped() ||
|
user_info_popped() ||
|
||||||
emoji_picker.reactions_popped() ||
|
emoji_picker.is_open() ||
|
||||||
$("[class^='column-'].expanded").length
|
$("[class^='column-'].expanded").length
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ const compose_actions = mock_esm("../src/compose_actions");
|
||||||
const condense = mock_esm("../src/condense");
|
const condense = mock_esm("../src/condense");
|
||||||
const drafts = mock_esm("../src/drafts");
|
const drafts = mock_esm("../src/drafts");
|
||||||
const emoji_picker = mock_esm("../src/emoji_picker", {
|
const emoji_picker = mock_esm("../src/emoji_picker", {
|
||||||
reactions_popped: () => false,
|
is_open: () => false,
|
||||||
toggle_emoji_popover() {},
|
toggle_emoji_popover() {},
|
||||||
});
|
});
|
||||||
const gear_menu = mock_esm("../src/gear_menu", {
|
const gear_menu = mock_esm("../src/gear_menu", {
|
||||||
|
@ -418,7 +418,7 @@ run_test("v w/no overlays", ({override}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("emoji picker", ({override}) => {
|
run_test("emoji picker", ({override}) => {
|
||||||
override(emoji_picker, "reactions_popped", () => true);
|
override(emoji_picker, "is_open", () => true);
|
||||||
assert_mapping(":", emoji_picker, "navigate", true);
|
assert_mapping(":", emoji_picker, "navigate", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue