Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
bot_settings: Add tabbed view for showing all and your bots.
Maneesh Shukla06f7ed6f9cbd
diff --git a/web/src/admin.ts b/web/src/admin.tsindex 67388c0645c..6a8ff8b1429 100644--- a/web/src/admin.ts+++ b/web/src/admin.ts@@ -282,6 +282,7 @@ export function build_page(): void {giphy_help_link,...get_realm_level_notification_settings(),all_bots_list_dropdown_widget_name: settings_users.all_bots_list_dropdown_widget_name,+ your_bots_list_dropdown_widget_name: settings_users.your_bots_list_dropdown_widget_name,group_setting_labels: settings_config.all_group_setting_labels.realm,server_can_summarize_topics: realm.server_can_summarize_topics,is_plan_self_hosted:@@ -339,5 +340,8 @@ export function launch(section: string, settings_tab: string | undefined): voidif (section === "users") {settings_panel_menu.org_settings.set_user_settings_tab(settings_tab);}+ if (section === "bots") {+ settings_panel_menu.org_settings.set_bot_settings_tab(settings_tab);+ }settings_toggle.goto("organization");}diff --git a/web/src/bot_data.ts b/web/src/bot_data.tsindex ba45c3a0da7..266835b5233 100644--- a/web/src/bot_data.ts+++ b/web/src/bot_data.ts@@ -58,6 +58,16 @@ export function get_all_bots_for_current_user(): Bot[] {return ret;}+export function get_all_bots_ids_for_current_user(): number[] {+ const ret = [];+ for (const bot of bots.values()) {+ if (bot.owner_id !== null && people.is_my_user_id(bot.owner_id)) {+ ret.push(bot.user_id);+ }+ }+ return ret;+}+export function get_all_bots_owned_by_user(user_id: number): Bot[] {const ret = [];for (const bot of bots.values()) {diff --git a/web/src/hashchange.ts b/web/src/hashchange.tsindex 10d056962c0..647de42f814 100644--- a/web/src/hashchange.ts+++ b/web/src/hashchange.ts@@ -74,9 +74,10 @@ function is_somebody_else_profile_open(): boolean {);}-function handle_invalid_section_url(section: "users", settings_tab: string): string {+function handle_invalid_section_url(section: "bots" | "users", settings_tab: string): string {const valid_tab_values = {users: new Set(["active", "deactivated", "invitations"]),+ bots: new Set(["all-bots", "your-bots"]),};if (!valid_tab_values[section].has(settings_tab)) {@@ -88,7 +89,7 @@ function handle_invalid_section_url(section: "users", settings_tab: string): str}function get_settings_tab(section: string): string | undefined {- if (section === "users") {+ if (section === "users" || section === "bots") {const current_settings_tab = hash_parser.get_current_nth_hash_section(2);return handle_invalid_section_url(section, current_settings_tab);}@@ -412,7 +413,11 @@ function do_hashchange_overlay(old_hash: string | undefined): void {settings_panel_menu.normal_settings.set_current_tab(section);} else {settings_panel_menu.org_settings.set_current_tab(section);- settings_panel_menu.org_settings.set_user_settings_tab(get_settings_tab(section));+ if (section === "users") {+ settings_panel_menu.org_settings.set_user_settings_tab(get_settings_tab(section));+ } else if (section === "bots") {+ settings_panel_menu.org_settings.set_bot_settings_tab(get_settings_tab(section));+ }}settings_toggle.goto(base);return;diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.jsindex 5426554695c..b5ec21f43b2 100644--- a/web/src/server_events_dispatch.js+++ b/web/src/server_events_dispatch.js@@ -495,14 +495,21 @@ export function dispatch_normal_event(event) {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();+ }break;case "delete":bot_data.del(event.bot.user_id);settings_bots.render_bots();+ settings_users.redraw_your_bots_list();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();+ }break;default:blueslip.error("Unexpected event type realm_bot/" + event.op);diff --git a/web/src/settings_panel_menu.ts b/web/src/settings_panel_menu.tsindex 7885792fcdc..1ab49971c25 100644--- a/web/src/settings_panel_menu.ts+++ b/web/src/settings_panel_menu.ts@@ -10,7 +10,12 @@ import * as keydown_util from "./keydown_util.ts";import * as popovers from "./popovers.ts";import * as scroll_util from "./scroll_util.ts";import * as settings_sections from "./settings_sections.ts";-import {redraw_active_users_list, redraw_deactivated_users_list} from "./settings_users.ts";+import {+ redraw_active_users_list,+ redraw_all_bots_list,+ redraw_deactivated_users_list,+ redraw_your_bots_list,+} from "./settings_users.ts";import * as util from "./util.ts";export let normal_settings: SettingsPanelMenu;@@ -61,7 +66,9 @@ export class SettingsPanelMenu {$curr_li: JQuery;current_tab: string;current_user_settings_tab: string | undefined;+ current_bot_settings_tab: string | undefined;org_user_settings_toggler: Toggle;+ org_bot_settings_toggler: Toggle;constructor(opts: {$main_elem: JQuery; hash_prefix: string}) {this.$main_elem = opts.$main_elem;@@ -69,6 +76,7 @@ export class SettingsPanelMenu {this.$curr_li = this.$main_elem.children("li").eq(0);this.current_tab = this.$curr_li.attr("data-section")!;this.current_user_settings_tab = "active";+ this.current_bot_settings_tab = "all-bots";this.org_user_settings_toggler = components.toggle({html_class: "org-user-settings-switcher",child_wants_focus: true,@@ -93,10 +101,34 @@ export class SettingsPanelMenu {},});+ this.org_bot_settings_toggler = components.toggle({+ html_class: "org-bot-settings-switcher",+ child_wants_focus: true,+ values: [+ {label: $t({defaultMessage: "All bots"}), key: "all-bots"},+ {+ label: $t({defaultMessage: "Your bots"}),+ key: "your-bots",+ },+ ],+ callback: (_name, key) => {+ browser_history.update(`#organization/bots/${key}`);+ this.set_bot_settings_tab(key);+ $(".bot-settings-section").hide();+ if (key === "all-bots") {+ redraw_all_bots_list();+ } else if (key === "your-bots") {+ redraw_your_bots_list();+ }+ $(`[data-bot-settings-section="${CSS.escape(key)}"]`).show();+ },+ });+this.$main_elem.on("click", "li[data-section]", (e) => {const section = $(e.currentTarget).attr("data-section")!;- this.activate_section_or_default(section, this.current_user_settings_tab);+ const settings_tab = this.get_settings_tab(section);+ this.activate_section_or_default(section, settings_tab);// You generally want to add logic to activate_section,// not to this click handler.@@ -107,10 +139,10 @@ export class SettingsPanelMenu {show(): void {this.$main_elem.show();const section = this.current_tab;- const user_settings_tab = this.current_user_settings_tab;const activate_section_for_mobile = two_column_mode();- this.activate_section_or_default(section, user_settings_tab, activate_section_for_mobile);+ const settings_tab = this.get_settings_tab(section);+ this.activate_section_or_default(section, settings_tab, activate_section_for_mobile);this.$curr_li.trigger("focus");}@@ -126,6 +158,18 @@ export class SettingsPanelMenu {}}+ show_org_bot_settings_toggler(): void {+ if ($("#admin-bot-list").find(".tab-switcher").length === 0) {+ const toggler_html = util.the(this.org_bot_settings_toggler.get());+ $("#admin-bot-list .tab-container").html(toggler_html);++ // We need to re-register these handlers since they are+ // destroyed once the settings modal closes.+ this.org_bot_settings_toggler.register_event_handlers();+ this.set_key_handlers(this.org_bot_settings_toggler, $(".org-bot-settings-switcher"));+ }+ }+hide(): void {this.$main_elem.hide();}@@ -185,6 +229,22 @@ export class SettingsPanelMenu {this.current_user_settings_tab = tab;}+ set_bot_settings_tab(tab: string | undefined): void {+ this.current_bot_settings_tab = tab;+ }++ get_settings_tab(section: string): string | undefined {+ if (section === "users") {+ return this.current_user_settings_tab;+ }++ if (section === "bots") {+ return this.current_bot_settings_tab;+ }++ return undefined;+ }+activate_section_or_default(section: string | undefined,settings_tab?: string,@@ -218,7 +278,7 @@ export class SettingsPanelMenu {this.$curr_li.addClass("active");this.set_current_tab(section);- if (section !== "users") {+ if (section !== "users" && section !== "bots") {const settings_section_hash = "#" + this.hash_prefix + section;// It could be that the hash has already been set.@@ -230,6 +290,12 @@ export class SettingsPanelMenu {this.org_user_settings_toggler.goto(settings_tab);}+ if (section === "bots" && this.org_bot_settings_toggler !== undefined) {+ assert(settings_tab !== undefined);+ this.show_org_bot_settings_toggler();+ this.org_bot_settings_toggler.goto(settings_tab);+ }+$(".settings-section").removeClass("show");settings_sections.load_settings_section(section);diff --git a/web/src/settings_users.ts b/web/src/settings_users.tsindex fef4e362e13..f1bb9c5ccc8 100644--- a/web/src/settings_users.ts+++ b/web/src/settings_users.ts@@ -5,6 +5,7 @@ import type * as tippy from "tippy.js";import render_settings_user_list_row from "../templates/settings/settings_user_list_row.hbs";import {compute_active_status, post_presence_response_schema} from "./activity.ts";+import * as bot_data from "./bot_data.ts";import * as browser_history from "./browser_history.ts";import * as channel from "./channel.ts";import * as dialog_widget from "./dialog_widget.ts";@@ -32,6 +33,7 @@ import * as util from "./util.ts";export const active_user_list_dropdown_widget_name = "active_user_list_select_user_role";export const deactivated_user_list_dropdown_widget_name = "deactivated_user_list_select_user_role";export const all_bots_list_dropdown_widget_name = "all_bots_list_select_bot_status";+export const your_bots_list_dropdown_widget_name = "your_bots_list_select_bot_status";let should_redraw_active_users_list = false;let should_redraw_deactivated_users_list = false;@@ -97,6 +99,17 @@ const all_bots_section: BotSettingsSection = {list_widget: undefined,};+const your_bots_section: BotSettingsSection = {+ dropdown_widget_name: your_bots_list_dropdown_widget_name,+ filters: {+ text_search: "",+ status_code: 0,+ },+ handle_events: your_bots_handle_events,+ create_table: create_your_bots_table,+ list_widget: undefined,+};+function sort_bot_email(a: BotInfo, b: BotInfo): number {function email(bot: BotInfo): string {return (bot.display_email ?? "").toLowerCase();@@ -269,8 +282,11 @@ function status_selected_handler(event.stopPropagation();const status_code = Number($(event.currentTarget).attr("data-unique-id"));- add_value_to_filters(all_bots_section, "status_code", status_code);-+ if (widget.widget_name === all_bots_section.dropdown_widget_name) {+ add_value_to_filters(all_bots_section, "status_code", status_code);+ } else if (widget.widget_name === your_bots_section.dropdown_widget_name) {+ add_value_to_filters(your_bots_section, "status_code", status_code);+ }dropdown.hide();widget.render();}@@ -452,6 +468,9 @@ function bot_info(bot_user_id: number): BotInfo {const owner_id = bot_user.bot_owner_id;const owner_full_name = bot_owner_full_name(owner_id);+ const is_bot_owner = owner_id === current_user.user_id;+ const can_modify_bot = current_user.is_admin || is_bot_owner;+return {is_bot: true,role: bot_user.role,@@ -466,9 +485,9 @@ function bot_info(bot_user_id: number): BotInfo {bot_owner_full_name: owner_full_name ?? $t({defaultMessage: "No owner"}),no_owner: !owner_full_name,is_current_user: false,- can_modify: current_user.is_admin,- cannot_deactivate: bot_user.is_system_bot ?? false,- cannot_edit: bot_user.is_system_bot ?? false,+ can_modify: can_modify_bot,+ cannot_deactivate: (bot_user.is_system_bot ?? false) || !can_modify_bot,+ cannot_edit: (bot_user.is_system_bot ?? false) || !can_modify_bot,// It's always safe to show the real email addresses for bot usersdisplay_email: bot_user.email,...(owner_id@@ -573,12 +592,12 @@ function create_all_bots_table(): void {return predicate_for_bot_filtering(item, all_bots_section);},is_active() {- const $search_input = $("#admin-bots-list .search");+ const $search_input = $("#admin-all-bots-list .search");return are_filters_active(all_bots_section.filters, $search_input);},onupdate: reset_scrollbar($all_bots_table),},- $parent_container: $("#admin-bot-list").expectOne(),+ $parent_container: $("#admin-all-bots-list").expectOne(),init_sort: "full_name_alphabetic",sort_fields: {email: sort_bot_email,@@ -586,7 +605,7 @@ function create_all_bots_table(): void {role: user_sort.sort_role,...ListWidget.generic_sort_functions("alphabetic", ["full_name", "bot_type"]),},- $simplebar_container: $("#admin-bot-list .progressive-table-wrapper"),+ $simplebar_container: $("#admin-all-bots-list .progressive-table-wrapper"),});set_text_search_value($all_bots_table, all_bots_section.filters.text_search);@@ -594,6 +613,44 @@ function create_all_bots_table(): void {$all_bots_table.show();}+function create_your_bots_table(): void {+ loading.make_indicator($("#admin_page_your_bots_loading_indicator"), {+ text: $t({defaultMessage: "Loading…"}),+ });+ const $your_bots_table = $("#admin_your_bots_table");+ $your_bots_table.hide();+ const bot_user_ids = bot_data.get_all_bots_ids_for_current_user();+ your_bots_section.list_widget = ListWidget.create($your_bots_table, bot_user_ids, {+ name: "admin_your_bot_list",+ get_item: bot_info,+ modifier_html: render_settings_user_list_row,+ html_selector: (item) => $(`tr[data-user-id='${CSS.escape(item.user_id.toString())}']`),+ filter: {+ predicate(item) {+ return predicate_for_bot_filtering(item, your_bots_section);+ },+ is_active() {+ const $search_input = $("#admin-your-bots-list .search");+ return are_filters_active(your_bots_section.filters, $search_input);+ },+ onupdate: reset_scrollbar($your_bots_table),+ },+ $parent_container: $("#admin-your-bots-list").expectOne(),+ init_sort: "full_name_alphabetic",+ sort_fields: {+ email: sort_bot_email,+ bot_owner: sort_bot_owner,+ role: user_sort.sort_role,+ ...ListWidget.generic_sort_functions("alphabetic", ["full_name", "bot_type"]),+ },+ $simplebar_container: $("#admin-your-bots-list .progressive-table-wrapper"),+ });+ set_text_search_value($your_bots_table, your_bots_section.filters.text_search);++ loading.destroy_indicator($("#admin_page_your_bots_loading_indicator"));+ $your_bots_table.show();+}+function active_create_table(active_users: number[]): void {const $users_table = $("#admin_users_table");active_section.list_widget = ListWidget.create($users_table, active_users, {@@ -686,11 +743,13 @@ function deactivated_create_table(deactivated_users: number[]): void {}export function update_bot_data(bot_user_id: number): void {- if (!all_bots_section.list_widget) {- return;+ if (all_bots_section.list_widget) {+ all_bots_section.list_widget.render_item(bot_info(bot_user_id));}- all_bots_section.list_widget.render_item(bot_info(bot_user_id));+ if (your_bots_section.list_widget) {+ your_bots_section.list_widget.render_item(bot_info(bot_user_id));+ }}export function update_user_data(@@ -735,6 +794,14 @@ function redraw_people_list(section.list_widget.replace_list_data(list);}+export function redraw_your_bots_list(): void {+ // In order to properly redraw after a user may have been added,+ // we need to update the your_bots_list_widget with the new set of bot+ // user IDs to display.+ const bot_user_ids_for_current_owner = bot_data.get_all_bots_ids_for_current_user();+ redraw_people_list(your_bots_section, bot_user_ids_for_current_owner);+}+export function redraw_deactivated_users_list(): void {if (!should_redraw_deactivated_users_list) {return;@@ -903,6 +970,16 @@ function all_bots_handle_events(): void {handle_clear_button_for_table_search_input($tbody);}+function your_bots_handle_events(): void {+ const $tbody = $("#admin_your_bots_table").expectOne();++ handle_filter_change($tbody, your_bots_section);+ handle_bot_deactivation($tbody);+ handle_reactivation($tbody);+ handle_edit_form($tbody);+ handle_clear_button_for_table_search_input($tbody);+}+export function set_up_humans(): void {start_data_load();active_section.handle_events();@@ -912,14 +989,17 @@ export function set_up_humans(): void {export function set_up_bots(): void {all_bots_section.handle_events();+ your_bots_section.handle_events();all_bots_section.create_table();+ your_bots_section.create_table();$("#admin-bot-list .add-a-new-bot").on("click", (e) => {e.preventDefault();e.stopPropagation();settings_bots.add_a_new_bot();});- create_status_filter_dropdown($("#admin-bot-list"), all_bots_section);+ create_status_filter_dropdown($("#admin-all-bots-list"), all_bots_section);+ create_status_filter_dropdown($("#admin-your-bots-list"), your_bots_section);}type FetchPresenceUserSettingParams = {diff --git a/web/styles/settings.css b/web/styles/settings.cssindex 1d179275611..6635fe712df 100644--- a/web/styles/settings.css+++ b/web/styles/settings.css@@ -355,6 +355,11 @@ select.settings_select {.table tr:first-of-type td {border-top: none;}++ .tab-switcher {+ margin-left: 0;+ margin-top: 1em;+ }}.user_role,diff --git a/web/templates/settings/bot_list.hbs b/web/templates/settings/bot_list.hbsindex a20ef42147a..81fea1ffa1f 100644--- a/web/templates/settings/bot_list.hbs+++ b/web/templates/settings/bot_list.hbs@@ -26,13 +26,11 @@<th data-sort="alphabetic" data-sort-prop="bot_type" class="bot_type">{{t "Bot type" }}<i class="table-sortable-arrow zulip-icon zulip-icon-sort-arrow-down"></i></th>- {{#if is_admin}}<th class="actions">{{t "Actions" }}</th>- {{/if}}</tr></thead><tbody id="admin_{{section_name}}_table" class="admin_bot_table"- data-empty="{{t 'There are no active bots in this organization.' }}" data-search-results-empty="{{t 'No bots match your current filter.' }}"></tbody>+ data-empty="{{#if (eq section_name 'all_bots')}}{{t 'There are no active bots in this organization.' }}{{else}}{{t 'You have no active bots'}}{{/if}}" data-search-results-empty="{{#if (eq section_name 'all_bots')}}{{t 'No bots match your current filter.' }}{{else}}{{t 'None of your bots match your current filter.' }}{{/if}}"></tbody></table></div><div id="admin_page_{{section_name}}_loading_indicator"></div>diff --git a/web/templates/settings/bot_list_admin.hbs b/web/templates/settings/bot_list_admin.hbsindex 42efefc2981..6006398543b 100644--- a/web/templates/settings/bot_list_admin.hbs+++ b/web/templates/settings/bot_list_admin.hbs@@ -1,4 +1,4 @@-<div id="admin-bot-list" class="settings-section user-or-bot-settings-section" data-name="bots">+<div id="admin-bot-list" class="settings-section" data-name="bots"><div class="bot-settings-tip banner-wrapper" id="admin-bot-settings-tip"></div><div class="clear-float"></div>@@ -11,10 +11,19 @@hidden=(not can_create_new_bots)}}</div>- {{> bot_list- section_name="all_bots"- section_title=(t "Bots")- dropdown_widget_name=all_bots_list_dropdown_widget_name- is_admin=is_admin- }}+ <div class="tab-container"></div>+ <div id="admin-all-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="all-bots">+ {{> bot_list+ section_name="all_bots"+ section_title=(t "All bots")+ dropdown_widget_name=all_bots_list_dropdown_widget_name+ }}+ </div>+ <div id="admin-your-bots-list" class="bot-settings-section user-or-bot-settings-section" data-bot-settings-section="your-bots">+ {{> bot_list+ section_name="your_bots"+ section_title=(t "Your bots")+ dropdown_widget_name=your_bots_list_dropdown_widget_name+ }}+ </div></div>diff --git a/web/templates/settings/settings_user_list_row.hbs b/web/templates/settings/settings_user_list_row.hbsindex 9bb9a4e5abf..99734705023 100644--- a/web/templates/settings/settings_user_list_row.hbs+++ b/web/templates/settings/settings_user_list_row.hbs@@ -36,7 +36,7 @@{{/if}}</td>{{/if}}- {{#if can_modify}}+ {{#if (or is_bot can_modify)}}<td class="actions"><span class="user-status-settings"><span class="{{#if (and is_bot cannot_edit)}}tippy-zulip-tooltip{{else}}tippy-zulip-delayed-tooltip{{/if}}"diff --git a/web/tests/bot_data.test.cjs b/web/tests/bot_data.test.cjsindex 295e2cf2149..96649c4edac 100644--- a/web/tests/bot_data.test.cjs+++ b/web/tests/bot_data.test.cjs@@ -217,3 +217,57 @@ test("test_basics", () => {assert.equal(bots_owned_by_user[0].email, "[email protected]");})();});++test("get_all_bots_ids_for_current_user", () => {+ bot_data.add({+ api_key: "testkey123",+ avatar_url: "",+ bot_type: 1,+ default_all_public_streams: true,+ default_events_register_stream: "register stream test",+ default_sending_stream: "sending stream test",+ email: "[email protected]",+ full_name: "Test Bot",+ is_active: true,+ owner_id: me.user_id,+ user_id: 101,+ services: [],+ });++ bot_data.add({+ api_key: "anotherkey456",+ avatar_url: "",+ bot_type: 1,+ default_all_public_streams: true,+ default_events_register_stream: "register stream another",+ default_sending_stream: "sending stream another",+ email: "[email protected]",+ full_name: "Another Bot",+ is_active: true,+ owner_id: fred.user_id,+ user_id: 102,+ services: [],+ });++ const my_bot_ids = bot_data.get_all_bots_ids_for_current_user();+ assert.deepEqual(my_bot_ids, [101]);++ // Ensure bots owned by others are not included+ bot_data.add({+ api_key: "anotherkey789",+ avatar_url: "",+ bot_type: 1,+ default_all_public_streams: true,+ default_events_register_stream: "register stream extra",+ default_sending_stream: "sending stream extra",+ email: "[email protected]",+ full_name: "Extra Bot",+ is_active: true,+ owner_id: fred.user_id,+ user_id: 103,+ services: [],+ });++ const my_updated_bot_ids = bot_data.get_all_bots_ids_for_current_user();+ assert.deepEqual(my_updated_bot_ids, [101]);+});diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjsindex 4f345afbf6c..ba3633b2dcd 100644--- a/web/tests/dispatch.test.cjs+++ b/web/tests/dispatch.test.cjs@@ -836,8 +836,11 @@ run_test("realm settings", ({override, override_rewire}) => {run_test("realm_bot add", ({override}) => {const event = event_fixtures.realm_bot__add;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);+dispatch(event);assert.equal(bot_stub.num_calls, 1);@@ -850,6 +853,7 @@ run_test("realm_bot delete", ({override}) => {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);dispatch(event);assert.equal(bot_stub.num_calls, 1);@@ -858,15 +862,26 @@ run_test("realm_bot delete", ({override}) => {});run_test("realm_bot update", ({override}) => {- const event = event_fixtures.realm_bot__update;- const bot_stub = make_stub();+ 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);assert.equal(bot_stub.num_calls, 1);- const args = bot_stub.get_args("user_id", "bot");+ let args = bot_stub.get_args("user_id", "bot");+ assert_same(args.user_id, event.bot.user_id);+ assert_same(args.bot, event.bot);++ bot_stub = make_stub();+ override(bot_data, "update", bot_stub.f);++ event = event_fixtures.realm_bot__update_owner;+ override(settings_users, "redraw_your_bots_list", noop);+ dispatch(event);+ assert.equal(bot_stub.num_calls, 1);+ args = bot_stub.get_args("user_id", "bot");assert_same(args.user_id, event.bot.user_id);assert_same(args.bot, event.bot);});diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjsindex 13bb9dd28a3..5ef8d79f665 100644--- a/web/tests/lib/events.cjs+++ b/web/tests/lib/events.cjs@@ -550,6 +550,15 @@ exports.fixtures = {},},+ realm_bot__update_owner: {+ type: "realm_bot",+ op: "update",+ bot: {+ user_id: 4321,+ owner_id: test_user.user_id,+ },+ },+realm_domains__add: {type: "realm_domains",op: "add",diff --git a/web/tests/people.test.cjs b/web/tests/people.test.cjsindex 57e37c46a6f..2b55a1c7482 100644--- a/web/tests/people.test.cjs+++ b/web/tests/people.test.cjs@@ -669,7 +669,7 @@ run_test("get_custom_fields_by_type", ({override}) => {run_test("bot_custom_profile_data", () => {initialize();// If this test fails, then try opening organization settings > bots- // http://localhost:9991/#organization/bots+ // http://localhost:9991/#organization/bots/all-bots// and then try to edit any of the bots.people.add_active_user(bot_botson);assert.equal(people.get_custom_profile_data(bot_botson.user_id, 3), undefined);