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: Redirect Bots in Personal Settings to Org Settings > Bots.

Maneesh Shukla2bf3d7458d63
diff --git a/web/e2e-tests/settings.test.ts b/web/e2e-tests/settings.test.ts
index 2538ddbec10..b94670f687c 100644
--- a/web/e2e-tests/settings.test.ts
+++ b/web/e2e-tests/settings.test.ts
@@ -16,6 +16,15 @@ async function get_decoded_url_in_selector(page: Page, selector: string): Promis
return decodeURIComponent(await (await a!.getProperty("href")).jsonValue());
}
+async function open_manage_bot_tab(page: Page, user_id: number): Promise<void> {
+ const manage_button_selector = `#admin_your_bots_table .user_row[data-user-id="${user_id}"] .manage-user-button`;
+ await page.waitForSelector(manage_button_selector, {visible: true});
+ await page.click(manage_button_selector);
+
+ // Wait for modal, then go to tab
+ await common.wait_for_micromodal_to_open(page);
+}
+
async function open_settings(page: Page): Promise<void> {
await common.open_personal_menu(page);
@@ -106,7 +115,7 @@ async function test_get_api_key(page: Page): Promise<void> {
}
async function test_webhook_bot_creation(page: Page): Promise<void> {
- await page.click("#bot-settings .add-a-new-bot");
+ await page.click("#admin-bot-list .add-a-new-bot");
await common.wait_for_micromodal_to_open(page);
assert.strictEqual(
await common.get_text_from_selector(page, ".dialog_heading"),
@@ -127,26 +136,30 @@ async function test_webhook_bot_creation(page: Page): Promise<void> {
await page.click(".micromodal .dialog_submit_button");
await common.wait_for_micromodal_to_close(page);
- const bot_email = "[email protected]";
- const download_zuliprc_selector = `.download_bot_zuliprc[data-email="${CSS.escape(
- bot_email,
- )}"]`;
+ const user_id = await common.get_user_id_from_name(page, "Bot 1");
+ await open_manage_bot_tab(page, user_id!);
+
const outgoing_webhook_zuliprc_regex =
/^data:application\/octet-stream;charset=utf-8,\[api]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;
+ const zuliprc_url_selector = `.hidden-zuliprc-download`;
+ const download_zuliprc_selector = `.download-bot-zuliprc`;
+
await page.waitForSelector(download_zuliprc_selector, {visible: true});
await page.click(download_zuliprc_selector);
- const zuliprc_decoded_url = await get_decoded_url_in_selector(page, download_zuliprc_selector);
+ const zuliprc_decoded_url = await get_decoded_url_in_selector(page, zuliprc_url_selector);
assert.match(
zuliprc_decoded_url,
outgoing_webhook_zuliprc_regex,
"Incorrect outgoing webhook bot zuliprc format",
);
+ await page.click(".micromodal .modal__close");
+ await common.wait_for_micromodal_to_close(page);
}
async function test_normal_bot_creation(page: Page): Promise<void> {
- await page.click("#bot-settings .add-a-new-bot");
+ await page.click("#admin-bot-list .add-a-new-bot");
await common.wait_for_micromodal_to_open(page);
assert.strictEqual(
await common.get_text_from_selector(page, ".dialog_heading"),
@@ -154,7 +167,7 @@ async function test_normal_bot_creation(page: Page): Promise<void> {
"Unexpected title for deactivate user modal",
);
assert.strictEqual(
- await common.get_text_from_selector(page, ".micromodal .dialog_submit_button"),
+ await common.get_text_from_selector(page, ".micromodal .dialog_submit_button span"),
"Add",
"Deactivate button has incorrect text.",
);
@@ -166,23 +179,26 @@ async function test_normal_bot_creation(page: Page): Promise<void> {
await page.click(".micromodal .dialog_submit_button");
await common.wait_for_micromodal_to_close(page);
- const bot_email = "[email protected]";
- const download_zuliprc_selector = `.download_bot_zuliprc[data-email="${CSS.escape(
- bot_email,
- )}"]`;
+ const user_id = await common.get_user_id_from_name(page, "Bot 2");
+ await open_manage_bot_tab(page, user_id!);
+
+ const zuliprc_url_selector = `.hidden-zuliprc-download`;
+ const download_zuliprc_selector = `.download-bot-zuliprc`;
await page.waitForSelector(download_zuliprc_selector, {visible: true});
await page.click(download_zuliprc_selector);
- const zuliprc_decoded_url = await get_decoded_url_in_selector(page, download_zuliprc_selector);
+ const zuliprc_decoded_url = await get_decoded_url_in_selector(page, zuliprc_url_selector);
assert.match(zuliprc_decoded_url, zuliprc_regex, "Incorrect zuliprc format for bot.");
+ await page.click(".micromodal .modal__close");
+ await common.wait_for_micromodal_to_close(page);
}
async function test_botserverrc(page: Page): Promise<void> {
- await page.click("#download_botserverrc");
- await page.waitForSelector('#download_botserverrc[href^="data:application"]', {visible: true});
+ await page.click("#download-botserverrc-file");
+ await page.waitForSelector('#hidden-botserverrc-download[href^="data:application"]');
const botserverrc_decoded_url = await get_decoded_url_in_selector(
page,
- "#download_botserverrc",
+ "#hidden-botserverrc-download",
);
const botserverrc_regex =
/^data:application\/octet-stream;charset=utf-8,\[]\nemail=.+\nkey=.+\nsite=.+\ntoken=.+\n$/;
@@ -272,7 +288,7 @@ async function test_invalid_edit_bot_form(page: Page): Promise<void> {
}
async function test_your_bots_section(page: Page): Promise<void> {
- await page.click('[data-section="your-bots"]');
+ await page.click(".your-bots-link");
await test_webhook_bot_creation(page);
await test_normal_bot_creation(page);
await test_botserverrc(page);
@@ -390,6 +406,12 @@ async function test_i18n_language_precedence(page: Page): Promise<void> {
}
async function test_default_language_setting(page: Page): Promise<void> {
+ // Since the "Bots" section of Personal Settings redirects us to Organization Settings > Bots with the "Your Bots" tab preselected,
+ // we need to switch back to the Personal Settings tab to proceed with further testing.
+ await page.waitForSelector('.tab-switcher .ind-tab[data-tab-key="settings"]', {visible: true});
+ await page.click('.tab-switcher .ind-tab[data-tab-key="settings"]');
+ await page.waitForSelector("#settings_overlay_container", {visible: true});
+
const preferences_section = '[data-section="preferences"]';
await page.click(preferences_section);
diff --git a/web/src/hashchange.ts b/web/src/hashchange.ts
index 647de42f814..5f048361e7a 100644
--- a/web/src/hashchange.ts
+++ b/web/src/hashchange.ts
@@ -306,6 +306,12 @@ function do_hashchange_overlay(old_hash: string | undefined): void {
// #settings/user-list-admin is being redirected to #settings/users after it was renamed.
section = "users";
}
+ if (section === "your-bots") {
+ // #settings/your-bots is being redirected to #organization/bots/your-bots.
+ section = "bots";
+ base = "organization";
+ window.history.replaceState(null, "", "#organization/bots/your-bots");
+ }
if ((base === "settings" || base === "organization") && !section) {
let settings_panel_object = settings_panel_menu.normal_settings;
if (base === "organization") {
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 31b7d5bd9f5..c963af8ade7 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -494,7 +494,6 @@ export function dispatch_normal_event(event) {
switch (event.op) {
case "add":
bot_data.add(event.bot);
- settings_bots.render_bots();
if (event.bot.owner_id === current_user.user_id) {
settings_users.redraw_your_bots_list();
settings_users.toggle_bot_config_download_container();
@@ -502,13 +501,11 @@ export function dispatch_normal_event(event) {
break;
case "delete":
bot_data.del(event.bot.user_id);
- settings_bots.render_bots();
settings_users.redraw_your_bots_list();
settings_users.toggle_bot_config_download_container();
break;
case "update":
bot_data.update(event.bot.user_id, event.bot);
- settings_bots.render_bots();
if ("owner_id" in event.bot) {
settings_users.redraw_your_bots_list();
settings_users.toggle_bot_config_download_container();
diff --git a/web/src/settings.ts b/web/src/settings.ts
index 37f094b3671..5ee1402531c 100644
--- a/web/src/settings.ts
+++ b/web/src/settings.ts
@@ -154,7 +154,6 @@ export function build_page(): void {
});
$(".settings-box").html(rendered_settings_tab);
- settings_bots.update_bot_settings_tip($("#personal-bot-settings-tip"));
common.adjust_mac_kbd_tags("#user_enter_sends_label kbd");
}
diff --git a/web/src/settings_bots.ts b/web/src/settings_bots.ts
index bcd6d065465..f7b0082dc87 100644
--- a/web/src/settings_bots.ts
+++ b/web/src/settings_bots.ts
@@ -1,106 +1,36 @@
-import ClipboardJS from "clipboard";
import $ from "jquery";
import assert from "minimalistic-assert";
-import * as z from "zod/mini";
import render_add_new_bot_form from "../templates/settings/add_new_bot_form.hbs";
-import render_bot_avatar_row from "../templates/settings/bot_avatar_row.hbs";
import render_bot_settings_tip from "../templates/settings/bot_settings_tip.hbs";
import * as avatar from "./avatar.ts";
-import * as bot_data from "./bot_data.ts";
-import * as bot_helper from "./bot_helper.ts";
import * as channel from "./channel.ts";
-import * as components from "./components.ts";
-import {show_copied_confirmation} from "./copied_tooltip.ts";
import {csrf_token} from "./csrf.ts";
import * as dialog_widget from "./dialog_widget.ts";
-import {$t, $t_html} from "./i18n.ts";
-import * as integration_url_modal from "./integration_url_modal.ts";
-import * as list_widget from "./list_widget.ts";
+import {$t_html} from "./i18n.ts";
import {page_params} from "./page_params.ts";
-import * as people from "./people.ts";
import * as settings_config from "./settings_config.ts";
import * as settings_data from "./settings_data.ts";
import {realm} from "./state_data.ts";
import type {HTMLSelectOneElement} from "./types.ts";
import * as ui_report from "./ui_report.ts";
import type {UploadWidget} from "./upload_widget.ts";
-import * as user_deactivation_ui from "./user_deactivation_ui.ts";
-import * as user_profile from "./user_profile.ts";
const INCOMING_WEBHOOK_BOT_TYPE = 2;
const OUTGOING_WEBHOOK_BOT_TYPE = "3";
-const OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
const EMBEDDED_BOT_TYPE = "4";
-type BotInfo = {
- name: string;
- email: string;
- user_id: number;
- type: string;
- avatar_url: string;
- api_key: string;
- is_active: boolean;
- is_incoming_webhook_bot: boolean;
- zuliprc: string;
-};
-
type BotType = {
type_id: number;
name: string;
};
-function add_bot_row(info: BotInfo): void {
- const $row = $(render_bot_avatar_row(info));
- if (info.is_active) {
- $("#active_bots_list").append($row);
- } else {
- $("#inactive_bots_list").append($row);
- }
-}
-
function is_local_part(value: string): boolean {
// Adapted from Django's EmailValidator
return /^[\w!#$%&'*+/=?^`{|}~-]+(\.[\w!#$%&'*+/=?^`{|}~-]+)*$/i.test(value);
}
-export function render_bots(): void {
- $("#active_bots_list").empty();
- $("#inactive_bots_list").empty();
-
- const all_bots_for_current_user = bot_data.get_all_bots_for_current_user();
- let user_owns_an_active_outgoing_webhook_bot = false;
-
- for (const elem of all_bots_for_current_user) {
- const type = settings_data.bot_type_id_to_string(elem.bot_type);
- assert(type !== undefined);
- add_bot_row({
- name: elem.full_name,
- email: elem.email,
- user_id: elem.user_id,
- type,
- avatar_url: elem.avatar_url,
- api_key: elem.api_key,
- is_active: elem.is_active,
- is_incoming_webhook_bot: elem.bot_type === INCOMING_WEBHOOK_BOT_TYPE,
- zuliprc: "zuliprc", // Most browsers do not allow filename starting with `.`
- });
- user_owns_an_active_outgoing_webhook_bot =
- user_owns_an_active_outgoing_webhook_bot ||
- (elem.is_active && elem.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT);
- }
-
- if (user_owns_an_active_outgoing_webhook_bot) {
- $("#active_bots_list_container .config-download-text").show();
- } else {
- $("#active_bots_list_container .config-download-text").hide();
- }
-
- list_widget.render_empty_list_message_if_needed($("#active_bots_list"));
- list_widget.render_empty_list_message_if_needed($("#inactive_bots_list"));
-}
-
export function generate_botserverrc_content(
email: string,
api_key: string,
@@ -157,11 +87,9 @@ export function update_bot_settings_tip($tip_container: JQuery): void {
function update_add_bot_button(): void {
if (can_create_incoming_webhooks()) {
- $("#bot-settings .add-a-new-bot").show();
$("#admin-bot-list .add-a-new-bot").show();
$(".org-settings-list li[data-section='bots'] .locked").hide();
} else {
- $("#bot-settings .add-a-new-bot").hide();
$("#admin-bot-list .add-a-new-bot").hide();
$(".org-settings-list li[data-section='bots'] .locked").show();
}
@@ -169,7 +97,6 @@ function update_add_bot_button(): void {
export function update_bot_permissions_ui(): void {
update_bot_settings_tip($("#admin-bot-settings-tip"));
- update_bot_settings_tip($("#personal-bot-settings-tip"));
update_add_bot_button();
}
@@ -330,159 +257,3 @@ export function add_a_new_bot(): void {
validate_input,
});
}
-
-export function set_up(): void {
- $("#download_botserverrc").on("click", function () {
- let content = "";
-
- for (const bot of bot_data.get_all_bots_for_current_user()) {
- if (bot.is_active && bot.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT) {
- const services = bot_data.get_services(bot.user_id);
- assert(services !== undefined);
- const service = services[0];
- assert(service && "token" in service);
- const bot_token = service.token;
- content += generate_botserverrc_content(bot.email, bot.api_key, bot_token);
- }
- }
-
- $(this).attr(
- "href",
- "data:application/octet-stream;charset=utf-8," + encodeURIComponent(content),
- );
- });
-
- const toggler = components.toggle({
- child_wants_focus: true,
- values: [
- {label: $t({defaultMessage: "Active bots"}), key: "active-bots"},
- {label: $t({defaultMessage: "Inactive bots"}), key: "inactive-bots"},
- ],
- callback(_name, key) {
- $(".bots_section").hide();
- $(`[data-bot-settings-section="${CSS.escape(key)}"]`).show();
- },
- });
-
- toggler.get().prependTo($("#bot-settings .tab-container"));
- toggler.goto("active-bots");
-
- render_bots();
-
- $("#active_bots_list").on("click", "button.deactivate_bot", function () {
- const bot_id = Number.parseInt($(this).attr("data-user-id")!, 10);
- const $row = $(this).closest("li");
-
- function handle_confirm(): void {
- const url = "/json/bots/" + encodeURIComponent(bot_id);
- const opts = {
- success_continuation() {
- $row.hide("slow", () => {
- $row.remove();
- });
- },
- };
- dialog_widget.submit_api_request(channel.del, url, {}, opts);
- }
- user_deactivation_ui.confirm_bot_deactivation(bot_id, handle_confirm, true);
- });
-
- $("#inactive_bots_list").on("click", "button.reactivate_bot", function (e) {
- const user_id = Number.parseInt($(this).attr("data-user-id")!, 10);
- e.stopPropagation();
- e.preventDefault();
-
- function handle_confirm(): void {
- void channel.post({
- url: "/json/users/" + encodeURIComponent(user_id) + "/reactivate",
- success() {
- dialog_widget.close();
- },
- error(xhr) {
- ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $("#dialog_error"));
- dialog_widget.hide_dialog_spinner();
- },
- });
- }
-
- user_deactivation_ui.confirm_reactivation(user_id, handle_confirm, true);
- });
-
- $("#active_bots_list").on("click", "button.bot-card-regenerate-bot-api-key", function () {
- const bot_id = Number.parseInt($(this).attr("data-user-id")!, 10);
- const $row = $(this).closest("li");
- void channel.post({
- url: "/json/bots/" + encodeURIComponent(bot_id) + "/api_key/regenerate",
- success(raw_data) {
- const data = z
- .object({
- api_key: z.string(),
- })
- .parse(raw_data);
- $row.find(".bot-card-api-key").find(".value").text(data.api_key);
- $row.find(".bot-card-api-key-error").hide();
- },
- error(xhr) {
- const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON);
- if (parsed.success && parsed.data.msg) {
- $row.find(".bot-card-api-key-error").text(parsed.data.msg).show();
- }
- },
- });
- });
-
- $("#active_bots_list").on("click", "button.open_edit_bot_form", (e) => {
- e.preventDefault();
- e.stopPropagation();
- const $li = $(e.currentTarget).closest("li");
- const bot_id = Number.parseInt($li.find(".bot-card-info").attr("data-user-id")!, 10);
- const bot = people.get_by_user_id(bot_id);
- user_profile.show_user_profile(bot, "manage-profile-tab");
- });
-
- $("#active_bots_list").on("click", "a.download_bot_zuliprc", function () {
- const $bot_info = $(this).closest(".bot-information-box").find(".bot-card-info");
- const bot_id = Number.parseInt($bot_info.attr("data-user-id")!, 10);
- $(this).attr("href", bot_helper.generate_zuliprc_url(bot_id));
- });
-
- $("#active_bots_list").on("click", "button.open_bots_subscribed_streams", function (e) {
- e.preventDefault();
- e.stopPropagation();
- const bot_id = Number.parseInt($(this).attr("data-user-id")!, 10);
- const bot = people.get_by_user_id(bot_id);
- user_profile.show_user_profile(bot, "user-profile-streams-tab");
- });
-
- $("#active_bots_list").on("click", "button.open-generate-integration-url-modal", function (e) {
- e.preventDefault();
- e.stopPropagation();
- const api_key = $(this).attr("data-api-key")!;
- integration_url_modal.show_generate_integration_url_modal(api_key);
- });
-
- const clipboard = new ClipboardJS("#copy_zuliprc", {
- text(trigger) {
- const $bot_info = $(trigger).closest(".bot-information-box").find(".bot-card-info");
- const bot_id = Number.parseInt($bot_info.attr("data-user-id")!, 10);
- const bot = bot_data.get(bot_id);
- assert(bot !== undefined);
- const data = bot_helper.generate_zuliprc_content(bot);
- return data;
- },
- });
-
- // Show a tippy tooltip when the bot zuliprc is copied
- clipboard.on("success", (e) => {
- assert(e.trigger instanceof HTMLElement);
- show_copied_confirmation(e.trigger, {
- show_check_icon: true,
- });
- });
-
- $("#bot-settings .add-a-new-bot").on("click", (e) => {
- e.preventDefault();
- e.stopPropagation();
- add_a_new_bot();
- });
-}
diff --git a/web/src/settings_sections.ts b/web/src/settings_sections.ts
index bb03b33811e..d6d618afd07 100644
--- a/web/src/settings_sections.ts
+++ b/web/src/settings_sections.ts
@@ -4,7 +4,6 @@ import * as alert_words_ui from "./alert_words_ui.ts";
import * as attachments_ui from "./attachments_ui.ts";
import * as blueslip from "./blueslip.ts";
import * as settings_account from "./settings_account.ts";
-import * as settings_bots from "./settings_bots.ts";
import * as settings_emoji from "./settings_emoji.ts";
import * as settings_exports from "./settings_exports.ts";
import * as settings_folders from "./settings_folders.ts";
@@ -59,7 +58,6 @@ export function initialize(): void {
assert(settings_notifications.user_settings_panel !== undefined);
settings_notifications.set_up(settings_notifications.user_settings_panel);
});
- load_func_dict.set("your-bots", settings_bots.set_up);
load_func_dict.set("alert-words", alert_words_ui.set_up_alert_words);
load_func_dict.set("uploaded-files", attachments_ui.set_up_attachments);
load_func_dict.set("topics", settings_user_topics.set_up);
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 071570776b6..54edc59ed3a 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -1008,154 +1008,6 @@ input[type="checkbox"] {
max-height: calc(95vh - 280px);
}
-#bot-settings {
- .add-a-new-bot {
- margin-bottom: 2px;
- margin-top: 10px;
- }
-
- hr {
- margin: 10px 0;
- border-color: hsl(0deg 0% 85%);
- }
-
- .config-download-text {
- margin-left: 5px;
- }
-
- .ind-tab {
- width: auto;
- min-width: 90px;
- }
-}
-
-.bots_list {
- list-style-type: none;
- margin-left: 0;
-
- .bot-card-image {
- vertical-align: top;
- }
-
- .bot-card-name {
- font-weight: 600;
- font-size: 1.1rem;
- margin: 7px 5px;
-
- overflow: hidden;
- line-height: 1.3em;
- text-overflow: ellipsis;
- white-space: pre;
- }
-
- .bot-card-regenerate-bot-api-key {
- position: relative;
- margin-left: 5px;
- color: hsl(0deg 0% 67%);
- transition: color 0.3s ease;
-
- &:hover {
- color: hsl(0deg 0% 27%);
- }
- }
-
- .edit-bot-buttons {
- padding-top: 5px;
-
- & button {
- background-color: transparent;
- }
-
- .bootstrap-btn {
- padding: 4px;
- }
-
- .sea-green {
- color: hsl(177deg 70% 46%);
- }
-
- .blue {
- color: hsl(203deg 77% 56%);
- }
-
- .danger-red {
- color: hsl(0deg 56% 73%);
- }
-
- .copy_zuliprc {
- color: hsl(51deg 90% 50%);
- }
-
- .purple {
- color: hsl(278deg 62% 68%);
- }
-
- .steel-blue {
- color: hsl(207deg 44% 49%);
- }
- }
-
- .bot-information-box {
- position: relative;
- display: inline-block;
- width: calc(50% - 10px);
- margin: 5px;
-
- border-radius: 4px;
- box-sizing: border-box;
-
- overflow: auto;
-
- .bot-card-details {
- display: inline-block;
- width: calc(100% - 75px);
- }
- }
-
- & img.bot-card-avatar {
- margin: 10px 5px 0 10px;
- height: 50px;
- width: 50px;
- border-radius: 4px;
- vertical-align: top;
- box-shadow: 0 0 4px hsl(0deg 0% 0% / 10%);
- }
-
- .bot-card-email,
- .bot-card-type {
- margin-bottom: 5px;
- }
-
- .bot-card-email .bot-card-value,
- .bot-card-api-key .bot-card-api-key-value-and-button {
- display: block;
- margin-left: 0;
- overflow-wrap: break-word;
- word-break: break-all;
- white-space: normal;
- }
-
- .bot-card-api-key .bot-card-api-key-value-and-button {
- font-family: "Source Code Pro", monospace;
- font-size: 0.85em;
- display: flex;
- }
-
- .bot-card-info {
- padding: 10px;
- }
-
- .bot-card-field {
- text-transform: uppercase;
- font-weight: 600;
- color: hsl(0deg 0% 67%);
- }
-}
-
-#inactive_bots_list .bot_info .reactivate_bot {
- margin-top: 5px;
-}
-
.edit_bot_form {
font-size: 100%;
margin: 0;
@@ -1510,6 +1362,11 @@ label.preferences-radio-choice-label {
overflow-y: auto;
border-right: 1px solid var(--color-border-modal);
+ .your-bots-link {
+ text-decoration: none;
+ color: inherit;
+ }
+
.header {
height: auto;
position: relative;
@@ -2152,15 +2009,6 @@ label.preferences-radio-choice-label {
}
}
-@media only screen and (width < $lg_min) {
- /* Show bot-information-box at full width on small
- screen sizes. Not having this media query breaks the
- information box */
- .bots_list .bot-information-box {
- width: calc(100% - 10px);
- }
-}
-
#edit-linkifier-form {
#edit-linkifier-pattern,
#edit-linkifier-url-template {
diff --git a/web/templates/settings/bot_avatar_row.hbs b/web/templates/settings/bot_avatar_row.hbs
deleted file mode 100644
index c28556a4b56..00000000000
--- a/web/templates/settings/bot_avatar_row.hbs
+++ /dev/null
@@ -1,57 +0,0 @@
-<li class="bot-information-box white-box">
- <div class="bot-card-image overflow-hidden">
- <img src="{{avatar_url}}" class="bot-card-avatar" />
- <div class="bot-card-details">
- <div class="bot-card-name">{{name}}</div>
- {{#if is_active}}
- <div class="edit-bot-buttons">
- <button type="submit" class="bootstrap-btn open_edit_bot_form tippy-zulip-delayed-tooltip manage-bot-button" data-sidebar-form="edit-bot" data-tippy-content="{{t 'Manage bot' }}" data-email="{{email}}">
- <i class="zulip-icon zulip-icon-user-cog blue" aria-hidden="true"></i>
- </button>
- <a type="submit" download="{{zuliprc}}" class="bootstrap-btn download_bot_zuliprc tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Download zuliprc' }}" data-email="{{email}}">
- <i class="fa fa-download sea-green" aria-hidden="true"></i>
- </a>
- <button type="submit" id="copy_zuliprc" class="bootstrap-btn copy_zuliprc tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Copy zuliprc' }}">
- <i class="zulip-icon zulip-icon-copy" aria-hidden="true"></i>
- </button>
- <button type="submit" class="bootstrap-btn deactivate_bot danger-red tippy-zulip-delayed-tooltip deactivate-bot-button" data-tippy-content="{{t 'Deactivate bot' }}" data-user-id="{{user_id}}">
- <i class="zulip-icon zulip-icon-user-x" aria-hidden="true"></i>
- </button>
- <button type="submit" class="bootstrap-btn open_bots_subscribed_streams tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Subscribed channels' }}" data-user-id="{{user_id}}">
- <i class="fa fa-hashtag purple" aria-hidden="true"></i>
- </button>
- {{#if is_incoming_webhook_bot}}
- <button type="submit" class="bootstrap-btn open-generate-integration-url-modal tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Generate URL for an integration'}}" data-api-key="{{api_key}}">
- <i class="fa fa-link steel-blue" aria-hidden="true"></i>
- </button>
- {{/if}}
- </div>
- {{/if}}
- </div>
- </div>
- <div class="bot-card-info" data-user-id="{{user_id}}">
- <div class="bot-card-type">
- <div class="bot-card-field">{{t "Bot type" }}</div>
- <div class="bot-card-value">{{type}}</div>
- </div>
- <div class="bot-card-email">
- <div class="bot-card-field">{{t "Bot email" }}</div>
- <div class="bot-card-value">{{email}}</div>
- </div>
- {{#if is_active}}
- <div class="bot-card-api-key">
- <span class="bot-card-field">{{t "API key" }}</span>
- <div class="bot-card-api-key-value-and-button no-select">
- <!-- have the `.text-select` in `.no-select` so that the value doesn't have trailing whitespace. -->
- <span class="bot-card-value text-select">{{api_key}}</span>
- <button type="submit" class="button no-style bot-card-regenerate-bot-api-key tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Generate new API key' }}" data-user-id="{{user_id}}">
- <i class="fa fa-refresh" aria-hidden="true"></i>
- </button>
- </div>
- <div class="bot-card-api-key-error text-error"></div>
- </div>
- {{else}}
- <button class="button round button-warning reactivate_bot" data-user-id="{{user_id}}">{{t "Reactivate bot" }}</button>
- {{/if}}
- </div>
-</li>
diff --git a/web/templates/settings/bot_settings.hbs b/web/templates/settings/bot_settings.hbs
deleted file mode 100644
index 9d2812ca070..00000000000
--- a/web/templates/settings/bot_settings.hbs
+++ /dev/null
@@ -1,44 +0,0 @@
-<div id="bot-settings" class="settings-section" data-name="your-bots">
- <div class="bot-settings-form">
- {{#unless current_user.is_guest}}
- <div>
- {{#tr}}
- See the <z-integrations>integrations</z-integrations> and <z-api>API</z-api> documentation for more information.
- {{#*inline "z-integrations"}}<a href="/integrations/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
- {{#*inline "z-api"}}<a href="/api/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
- {{/tr}}
- </div>
- <div class="bot-settings-tip banner-wrapper" id="personal-bot-settings-tip">
- </div>
- <div>
- {{> ../components/action_button
- label=(t "Add a new bot")
- attention="quiet"
- intent="brand"
- custom_classes="add-a-new-bot"
- hidden=(not can_create_new_bots)
- }}
- </div>
- {{/unless}}
-
- <hr/>
-
- <div class="tab-container"></div>
-
- <div id="active_bots_list_container" class="bots_section" data-bot-settings-section="active-bots">
- <div class="config-download-text">
- <span>{{t 'Download config of all active outgoing webhook bots in Zulip Botserver format.' }}</span>
- <a type="submit" download="{{botserverrc}}" id= "download_botserverrc" class="bootstrap-btn tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Download botserverrc' }}">
- <i class="fa fa-download sea-green" aria-hidden="true"></i>
- </a>
- </div>
- <ol id="active_bots_list" class="bots_list" data-empty="{{t 'You have no active bots.' }}">
- </ol>
- </div>
-
- <div id="inactive_bots_list_container" class="bots_section" data-bot-settings-section="inactive-bots">
- <ol id="inactive_bots_list" class="bots_list" data-empty="{{t 'You have no inactive bots.' }}">
- </ol>
- </div>
- </div>
-</div>
diff --git a/web/templates/settings_overlay.hbs b/web/templates/settings_overlay.hbs
index 91759707024..2ff3171c2b7 100644
--- a/web/templates/settings_overlay.hbs
+++ b/web/templates/settings_overlay.hbs
@@ -28,10 +28,12 @@
<div class="text">{{t "Notifications" }}</div>
</li>
{{#unless is_guest}}
- <li class="sidebar-item" tabindex="0" data-section="your-bots">
- <i class="sidebar-item-icon zulip-icon zulip-icon-bot" aria-hidden="true"></i>
- <div class="text">{{t "Bots" }}</div>
- </li>
+ <li class="redirected-sidebar-item" tabindex="0">
+ <a href="#organization/bots/your-bots" class="your-bots-link sidebar-item">
+ <i class="sidebar-item-icon zulip-icon zulip-icon-bot" aria-hidden="true"></i>
+ <div class="text">{{t 'Bots'}}</div>
+ </a>
+ </li>
{{/unless}}
<li class="sidebar-item" tabindex="0" data-section="alert-words">
<i class="sidebar-item-icon fa fa-book" aria-hidden="true"></i>
diff --git a/web/templates/settings_tab.hbs b/web/templates/settings_tab.hbs
index 2510bf2951a..bc85249695c 100644
--- a/web/templates/settings_tab.hbs
+++ b/web/templates/settings_tab.hbs
@@ -7,8 +7,6 @@
{{> settings/user_notification_settings . }}
- {{> settings/bot_settings . }}
-
{{> settings/alert_word_settings }}
{{> settings/attachments_settings }}
diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjs
index 3f608b7c53f..76d87e15786 100644
--- a/web/tests/dispatch.test.cjs
+++ b/web/tests/dispatch.test.cjs
@@ -838,7 +838,6 @@ run_test("realm_bot add", ({override}) => {
const bot_stub = make_stub();
override(current_user, "user_id", test_user.user_id);
override(bot_data, "add", bot_stub.f);
- override(settings_bots, "render_bots", noop);
override(settings_users, "redraw_your_bots_list", noop);
override(settings_users, "toggle_bot_config_download_container", noop);
@@ -853,7 +852,6 @@ run_test("realm_bot delete", ({override}) => {
const event = event_fixtures.realm_bot__delete;
const bot_stub = make_stub();
override(bot_data, "del", bot_stub.f);
- override(settings_bots, "render_bots", noop);
override(settings_users, "redraw_your_bots_list", noop);
override(settings_users, "toggle_bot_config_download_container", noop);
@@ -867,7 +865,6 @@ run_test("realm_bot update", ({override}) => {
let event = event_fixtures.realm_bot__update;
let bot_stub = make_stub();
override(bot_data, "update", bot_stub.f);
- override(settings_bots, "render_bots", noop);
dispatch(event);