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_bots: Display "Deactivate bot" button inside bot edit modal.

yogesh sirsat5697c047fcf7
diff --git a/static/js/settings_users.js b/static/js/settings_users.js
index 48b333ec519..d19e16cbf3b 100644
--- a/static/js/settings_users.js
+++ b/static/js/settings_users.js
@@ -694,6 +694,19 @@ export function show_edit_bot_info_modal(user_id, from_user_info_popover) {
.find(`option[value="${CSS.escape(settings_config.user_role_values.owner.code)}"]`)
.hide();
}
+
+ $("#bot-edit-form").on("click", ".deactivate_bot_button", (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const bot_id = $("#bot-edit-form").data("user-id");
+ function handle_confirm() {
+ const url = "/json/bots/" + encodeURIComponent(bot_id);
+ dialog_widget.submit_api_request(channel.del, url);
+ }
+ const open_deactivate_modal_callback = () =>
+ confirm_bot_deactivation(bot_id, handle_confirm, true);
+ dialog_widget.close_modal(open_deactivate_modal_callback);
+ });
}
dialog_widget.launch({
diff --git a/static/templates/settings/edit_bot_form.hbs b/static/templates/settings/edit_bot_form.hbs
index d015c8285cf..4818710b4a5 100644
--- a/static/templates/settings/edit_bot_form.hbs
+++ b/static/templates/settings/edit_bot_form.hbs
@@ -27,5 +27,10 @@
widget_name="edit_bot_owner"
list_placeholder=(t 'Filter users')}}
</div>
+ <div class="input-group new-style">
+ <button class="button rounded btn-danger deactivate_bot_button">
+ {{t 'Deactivate bot' }}
+ </button>
+ </div>
</form>
</div>