From 4b7a55d2c9ae1c62924af40aaccbd1ce1db40149 Mon Sep 17 00:00:00 2001 From: SameepAher Date: Mon, 27 Feb 2023 19:27:17 +0530 Subject: [PATCH] popovers: Close user popovers on button click. Close the user or bot popovers in Users, Deactivated users, bots tab of Organization settings, on clicking Edit user button, Deactivate button or Reactivate button. --- web/src/settings_users.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/src/settings_users.js b/web/src/settings_users.js index af93865e1a..01332c750a 100644 --- a/web/src/settings_users.js +++ b/web/src/settings_users.js @@ -16,6 +16,7 @@ import * as ListWidget from "./list_widget"; import * as loading from "./loading"; import {page_params} from "./page_params"; import * as people from "./people"; +import * as popovers from "./popovers"; import * as presence from "./presence"; import * as settings_account from "./settings_account"; import * as settings_bots from "./settings_bots"; @@ -504,6 +505,7 @@ function handle_deactivation($tbody) { // will not show up because of a call to `close_active_modal` in `settings.js`. e.preventDefault(); e.stopPropagation(); + popovers.hide_all(); const $row = $(e.target).closest(".user_row"); const user_id = $row.data("user-id"); @@ -528,6 +530,7 @@ function handle_bot_deactivation($tbody) { $tbody.on("click", ".deactivate", (e) => { e.preventDefault(); e.stopPropagation(); + popovers.hide_all(); const $button_elem = $(e.target); const $row = $button_elem.closest(".user_row"); @@ -569,6 +572,8 @@ function handle_reactivation($tbody) { $tbody.on("click", ".reactivate", (e) => { e.preventDefault(); e.stopPropagation(); + popovers.hide_all(); + // Go up the tree until we find the user row, then grab the email element const $button_elem = $(e.target); const $row = $button_elem.closest(".user_row"); @@ -675,6 +680,8 @@ function handle_human_form($tbody) { $tbody.on("click", ".open-user-form", (e) => { e.stopPropagation(); e.preventDefault(); + popovers.hide_all(); + const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10); show_edit_user_info_modal(user_id, false); }); @@ -684,6 +691,8 @@ function handle_bot_form($tbody) { $tbody.on("click", ".open-user-form", (e) => { e.stopPropagation(); e.preventDefault(); + popovers.hide_all(); + const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10); settings_bots.show_edit_bot_info_modal(user_id, false); });