Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

sahil839231af0f84d96
diff --git a/static/js/popovers.js b/static/js/popovers.js
index 5a68f4d4f46..96fb04b0794 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -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", () => {
diff --git a/static/js/settings_users.js b/static/js/settings_users.js
index a8fcb98844c..919e544b7f3 100644
--- a/static/js/settings_users.js
+++ b/static/js/settings_users.js
@@ -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) {
tbody.on("click", ".open-user-form", (e) => {
e.stopPropagation();
@@ -686,7 +676,6 @@ section.bots.handle_events = () => {
const tbody = $("#admin_bots_table").expectOne();
const status_field = $("#bot-field-status").expectOne();
- handle_bot_owner_profile(tbody);
handle_bot_deactivation(tbody, status_field);
handle_reactivation(tbody, status_field);
handle_bot_form(tbody, status_field);
diff --git a/static/templates/user_info_popover_content.hbs b/static/templates/user_info_popover_content.hbs
index bffea34b55a..76814701be1 100644
--- a/static/templates/user_info_popover_content.hbs
+++ b/static/templates/user_info_popover_content.hbs
@@ -35,7 +35,7 @@
{{#if is_bot}}
{{#if bot_owner}}
<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}}
</span>
</li>
@@ -92,7 +92,7 @@
<hr>
{{#if show_user_profile}}
<li>
- <a tabindex="0" class="view_user_profile">
+ <a tabindex="0" class="view_full_user_profile">
{{#if is_me}}
<i class="fa fa-user" aria-hidden="true"></i> {{#tr this}}View your profile{{/tr}}
{{else}}