mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
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:
@@ -893,7 +893,7 @@ exports.register_click_handlers = function () {
|
|||||||
e.preventDefault();
|
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_id = elem_to_user_id($(e.target).parents("ul"));
|
||||||
const user = people.get_by_user_id(user_id);
|
const user = people.get_by_user_id(user_id);
|
||||||
exports.show_user_profile(user);
|
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_id = parseInt($(e.target).attr("data-user-id"), 10);
|
||||||
const user = people.get_by_user_id(user_id);
|
const user = people.get_by_user_id(user_id);
|
||||||
exports.show_user_info_popover(e.target, user);
|
exports.show_user_info_popover(e.target, user);
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("click", "#user-profile-modal #name #edit-button", () => {
|
$("body").on("click", "#user-profile-modal #name #edit-button", () => {
|
||||||
|
|||||||
@@ -583,16 +583,6 @@ function handle_reactivation(tbody, status_field) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_bot_owner_profile(tbody) {
|
|
||||||
tbody.on("click", ".user_row .view_user_profile", (e) => {
|
|
||||||
const owner_id = parseInt($(e.target).attr("data-user-id"), 10);
|
|
||||||
const owner = people.get_by_user_id(owner_id);
|
|
||||||
popovers.show_user_info_popover(e.target, owner);
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handle_human_form(tbody, status_field) {
|
function handle_human_form(tbody, status_field) {
|
||||||
tbody.on("click", ".open-user-form", (e) => {
|
tbody.on("click", ".open-user-form", (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -686,7 +676,6 @@ section.bots.handle_events = () => {
|
|||||||
const tbody = $("#admin_bots_table").expectOne();
|
const tbody = $("#admin_bots_table").expectOne();
|
||||||
const status_field = $("#bot-field-status").expectOne();
|
const status_field = $("#bot-field-status").expectOne();
|
||||||
|
|
||||||
handle_bot_owner_profile(tbody);
|
|
||||||
handle_bot_deactivation(tbody, status_field);
|
handle_bot_deactivation(tbody, status_field);
|
||||||
handle_reactivation(tbody, status_field);
|
handle_reactivation(tbody, status_field);
|
||||||
handle_bot_form(tbody, status_field);
|
handle_bot_form(tbody, status_field);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
{{#if is_bot}}
|
{{#if is_bot}}
|
||||||
{{#if bot_owner}}
|
{{#if bot_owner}}
|
||||||
<li>{{#tr this}}Owner{{/tr}}:
|
<li>{{#tr this}}Owner{{/tr}}:
|
||||||
<span class="bot-owner-name" data-user-id='{{ bot_owner.user_id }}'>
|
<span class="bot-owner-name view_user_profile" data-user-id='{{ bot_owner.user_id }}'>
|
||||||
{{bot_owner.full_name}}
|
{{bot_owner.full_name}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
{{#if show_user_profile}}
|
{{#if show_user_profile}}
|
||||||
<li>
|
<li>
|
||||||
<a tabindex="0" class="view_user_profile">
|
<a tabindex="0" class="view_full_user_profile">
|
||||||
{{#if is_me}}
|
{{#if is_me}}
|
||||||
<i class="fa fa-user" aria-hidden="true"></i> {{#tr this}}View your profile{{/tr}}
|
<i class="fa fa-user" aria-hidden="true"></i> {{#tr this}}View your profile{{/tr}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|||||||
Reference in New Issue
Block a user