Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_list: Add separate handler, longer delay on reaction button.
Karl Stolley8f74d4529e86
diff --git a/web/src/message_list_tooltips.js b/web/src/message_list_tooltips.jsindex 80f6181ec29..2c0ed83875e 100644--- a/web/src/message_list_tooltips.js+++ b/web/src/message_list_tooltips.js@@ -104,7 +104,7 @@ export function initialize() {// message reaction tooltip showing who reacted.let observer;- message_list_tooltip(".message_reaction, .message_reactions .reaction_button", {+ message_list_tooltip(".message_reaction", {delay: INTERACTIVE_HOVER_DELAY,placement: "bottom",onShow(instance) {@@ -114,12 +114,10 @@ export function initialize() {return false;}const $elem = $(instance.reference);- if (!instance.reference.classList.contains("reaction_button")) {- const local_id = $elem.attr("data-reaction-id");- const message_id = rows.get_message_id(instance.reference);- const title = reactions.get_reaction_title_data(message_id, local_id);- instance.setContent(title);- }+ const local_id = $elem.attr("data-reaction-id");+ const message_id = rows.get_message_id(instance.reference);+ const title = reactions.get_reaction_title_data(message_id, local_id);+ instance.setContent(title);const config = {attributes: false, childList: true, subtree: true};const target = $elem.parents(".message-list.focused-message-list").get(0);@@ -139,6 +137,34 @@ export function initialize() {},});+ message_list_tooltip(".message_reactions .reaction_button", {+ delay: LONG_HOVER_DELAY,+ placement: "bottom",+ onShow(instance) {+ if (!document.body.contains(instance.reference)) {+ // It is possible for the single reaction necessary for+ // displaying the reaction button to be removed before+ // `onShow` is triggered, so we check if the element+ // exists before proceeding.+ return false;+ }+ const $elem = $(instance.reference);++ const config = {attributes: false, childList: true, subtree: true};+ const target = $elem.parents(".message-list.focused-message-list").get(0);+ const nodes_to_check_for_removal = [+ $elem.parents(".recipient_row").get(0),+ $elem.parents(".message_reactions").get(0),+ $elem.get(0),+ ];+ hide_tooltip_if_reference_removed(target, config, instance, nodes_to_check_for_removal);+ return true;+ },+ onHidden(instance) {+ instance.destroy();+ },+ });+message_list_tooltip(".message_control_button", {delay: LONG_HOVER_DELAY,onShow(instance) {