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: Make it possible to add new bots from org settings.

Yogesh Sirsat0b3dd4755eb8
diff --git a/static/js/admin.js b/static/js/admin.js
index b1e3bcf580e..5376c6f4d19 100644
--- a/static/js/admin.js
+++ b/static/js/admin.js
@@ -107,6 +107,7 @@ export function build_page() {
realm_avatar_changes_disabled: page_params.realm_avatar_changes_disabled,
realm_add_custom_emoji_policy: page_params.realm_add_custom_emoji_policy,
can_add_emojis: settings_data.user_can_add_custom_emoji(),
+ can_create_new_bots: settings_bots.can_create_new_bots(),
realm_message_content_edit_limit_minutes: settings_org.get_realm_time_limits_in_minutes(
"realm_message_content_edit_limit_seconds",
),
diff --git a/static/js/settings_users.js b/static/js/settings_users.js
index bfeb69a0219..acce49abda3 100644
--- a/static/js/settings_users.js
+++ b/static/js/settings_users.js
@@ -693,4 +693,10 @@ export function set_up_humans() {
export function set_up_bots() {
section.bots.handle_events();
section.bots.create_table();
+
+ $("#admin-bot-list .add-a-new-bot").on("click", (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ settings_bots.add_a_new_bot();
+ });
}
diff --git a/static/templates/settings/bot_list_admin.hbs b/static/templates/settings/bot_list_admin.hbs
index 33dea6adb99..888537c4aa1 100644
--- a/static/templates/settings/bot_list_admin.hbs
+++ b/static/templates/settings/bot_list_admin.hbs
@@ -1,7 +1,9 @@
<div id="admin-bot-list" class="settings-section" data-name="bot-list-admin">
<div class="tip bot-settings-tip"></div>
<div class="clear-float"></div>
-
+ <div>
+ <button class="button rounded sea-green add-a-new-bot {{#unless can_create_new_bots}}hide{{/unless}}">{{t "Add a new bot" }}</button>
+ </div>
<div class="settings_panel_list_header">
<h3>{{t "Bots"}}</h3>
<div class="alert-notification" id="bot-field-status"></div>