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.)
This commit is contained in:
Steve Howell 2019-03-08 19:06:07 +00:00 committed by Tim Abbott
parent fb750a2656
commit 725bdcc384
2 changed files with 4 additions and 7 deletions

View File

@ -95,7 +95,8 @@ function make_image_stubber() {
run_test('sender_hover', () => { run_test('sender_hover', () => {
popovers.register_click_handlers(); 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 = { var e = {
stopPropagation: noop, stopPropagation: noop,
}; };

View File

@ -651,17 +651,13 @@ exports.register_click_handlers = function () {
popovers.toggle_actions_popover(this, rows.id(row)); 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"); var row = $(this).closest(".message_row");
e.stopPropagation(); e.stopPropagation();
var message = current_msg_list.get(rows.id(row)); var message = current_msg_list.get(rows.id(row));
var user = people.get_person_from_user_id(message.sender_id); var user = people.get_person_from_user_id(message.sender_id);
// For /me says hi, the avatar and sender-name have individual show_user_info_popover(this, user, message);
// 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);
}); });
$("#main_div").on("click", ".user-mention", function (e) { $("#main_div").on("click", ".user-mention", function (e) {