popovers: Make a single click handler for opening bot owner popover.

We remove handle_bot_owner_profile function and we handle the opening
of popover of bot owner from a single click handler in popovers.js
using 'view_user_profile' class.

We also rename 'view_user_profile' class to 'view_full_user_profile'
for the button in popover, which is used to open full user profile.
This commit is contained in:
sahil839
2020-09-19 18:45:44 +05:30
committed by Tim Abbott
parent 4dc3e5f96f
commit 231af0f84d
3 changed files with 6 additions and 15 deletions

View File

@@ -893,7 +893,7 @@ exports.register_click_handlers = function () {
e.preventDefault();
});
$("body").on("click", ".info_popover_actions .view_user_profile", (e) => {
$("body").on("click", ".info_popover_actions .view_full_user_profile", (e) => {
const user_id = elem_to_user_id($(e.target).parents("ul"));
const user = people.get_by_user_id(user_id);
exports.show_user_profile(user);
@@ -913,10 +913,12 @@ exports.register_click_handlers = function () {
});
});
$("body").on("click", ".bot-owner-name", (e) => {
$("body").on("click", ".view_user_profile", (e) => {
const user_id = parseInt($(e.target).attr("data-user-id"), 10);
const user = people.get_by_user_id(user_id);
exports.show_user_info_popover(e.target, user);
e.stopPropagation();
e.preventDefault();
});
$("body").on("click", "#user-profile-modal #name #edit-button", () => {