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.
This commit is contained in:
SameepAher 2023-02-27 19:27:17 +05:30 committed by Tim Abbott
parent 3950a8e19d
commit 4b7a55d2c9
1 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import * as ListWidget from "./list_widget";
import * as loading from "./loading"; import * as loading from "./loading";
import {page_params} from "./page_params"; import {page_params} from "./page_params";
import * as people from "./people"; import * as people from "./people";
import * as popovers from "./popovers";
import * as presence from "./presence"; import * as presence from "./presence";
import * as settings_account from "./settings_account"; import * as settings_account from "./settings_account";
import * as settings_bots from "./settings_bots"; 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`. // will not show up because of a call to `close_active_modal` in `settings.js`.
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
popovers.hide_all();
const $row = $(e.target).closest(".user_row"); const $row = $(e.target).closest(".user_row");
const user_id = $row.data("user-id"); const user_id = $row.data("user-id");
@ -528,6 +530,7 @@ function handle_bot_deactivation($tbody) {
$tbody.on("click", ".deactivate", (e) => { $tbody.on("click", ".deactivate", (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
popovers.hide_all();
const $button_elem = $(e.target); const $button_elem = $(e.target);
const $row = $button_elem.closest(".user_row"); const $row = $button_elem.closest(".user_row");
@ -569,6 +572,8 @@ function handle_reactivation($tbody) {
$tbody.on("click", ".reactivate", (e) => { $tbody.on("click", ".reactivate", (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
popovers.hide_all();
// Go up the tree until we find the user row, then grab the email element // Go up the tree until we find the user row, then grab the email element
const $button_elem = $(e.target); const $button_elem = $(e.target);
const $row = $button_elem.closest(".user_row"); const $row = $button_elem.closest(".user_row");
@ -675,6 +680,8 @@ function handle_human_form($tbody) {
$tbody.on("click", ".open-user-form", (e) => { $tbody.on("click", ".open-user-form", (e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
popovers.hide_all();
const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10); const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10);
show_edit_user_info_modal(user_id, false); show_edit_user_info_modal(user_id, false);
}); });
@ -684,6 +691,8 @@ function handle_bot_form($tbody) {
$tbody.on("click", ".open-user-form", (e) => { $tbody.on("click", ".open-user-form", (e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
popovers.hide_all();
const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10); const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10);
settings_bots.show_edit_bot_info_modal(user_id, false); settings_bots.show_edit_bot_info_modal(user_id, false);
}); });