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.

settings: Add confirmation modal for reactivating a bot in personal settings.

Rishant Rokahaa9893fb6545b
diff --git a/static/js/settings_bots.js b/static/js/settings_bots.js
index 6038aecfb56..a6c678d4493 100644
--- a/static/js/settings_bots.js
+++ b/static/js/settings_bots.js
@@ -19,6 +19,7 @@ import {$t, $t_html} from "./i18n";
import {page_params} from "./page_params";
import * as people from "./people";
import * as settings_config from "./settings_config";
+import * as settings_users from "./settings_users";
import * as ui_report from "./ui_report";
import * as user_profile from "./user_profile";
@@ -539,13 +540,23 @@ export function set_up() {
$("#inactive_bots_list").on("click", "button.reactivate_bot", (e) => {
const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10);
+ e.stopPropagation();
+ e.preventDefault();
- channel.post({
- url: "/json/users/" + encodeURIComponent(user_id) + "/reactivate",
- error(xhr) {
- bot_error(user_id, xhr);
- },
- });
+ function handle_confirm() {
+ channel.post({
+ url: "/json/users/" + encodeURIComponent(user_id) + "/reactivate",
+ success() {
+ dialog_widget.close_modal();
+ },
+ error(xhr) {
+ ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
+ dialog_widget.hide_dialog_spinner();
+ },
+ });
+ }
+
+ settings_users.confirm_reactivation(user_id, handle_confirm, true);
});
$("#active_bots_list").on("click", "button.regenerate_bot_api_key", (e) => {
diff --git a/templates/zerver/help/deactivate-or-reactivate-a-bot.md b/templates/zerver/help/deactivate-or-reactivate-a-bot.md
index dab61f542c6..a1f6f3b56e5 100644
--- a/templates/zerver/help/deactivate-or-reactivate-a-bot.md
+++ b/templates/zerver/help/deactivate-or-reactivate-a-bot.md
@@ -55,6 +55,8 @@ bot, regardless of who owns them.
1. Click **Reactivate bot** on the profile card for the bot you want to reactivate.
+1. Approve by clicking **Confirm**.
+
{tab|via-organization-settings}
{settings_tab|bot-list-admin}