From 725bdcc3843c30fec7b4fa1c83b3719ae38d27e2 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 8 Mar 2019 19:06:07 +0000 Subject: [PATCH] user popover: Pop user menu closer to avatar. If you click on the avatar, we now show the menu right next to the avatar. The current behavior is particularly funny for long names. (I confirmed this with Rishi.) --- frontend_tests/node_tests/popovers.js | 3 ++- static/js/popovers.js | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index d1e28d2b26..b1b88844d3 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -95,7 +95,8 @@ function make_image_stubber() { run_test('sender_hover', () => { popovers.register_click_handlers(); - var handler = $('#main_div').get_on_handler('click', '.sender_info_hover'); + var selection = ".sender_name, .sender_name-in-status, .inline_profile_picture"; + var handler = $('#main_div').get_on_handler('click', selection); var e = { stopPropagation: noop, }; diff --git a/static/js/popovers.js b/static/js/popovers.js index 85fa1f6310..c51cd8d656 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -651,17 +651,13 @@ exports.register_click_handlers = function () { popovers.toggle_actions_popover(this, rows.id(row)); }); - $("#main_div").on("click", ".sender_info_hover", function (e) { + $("#main_div").on("click", ".sender_name, .sender_name-in-status, .inline_profile_picture", function (e) { var row = $(this).closest(".message_row"); e.stopPropagation(); var message = current_msg_list.get(rows.id(row)); var user = people.get_person_from_user_id(message.sender_id); - // For /me says hi, the avatar and sender-name have individual - // sender_info_hover spans, and we the last one. - var elt = row.find('.sender_info_hover').last()[0]; - - show_user_info_popover(elt, user, message); + show_user_info_popover(this, user, message); }); $("#main_div").on("click", ".user-mention", function (e) {