diff --git a/web/src/settings_bots.js b/web/src/settings_bots.js index 8f75755108..e8fa449279 100644 --- a/web/src/settings_bots.js +++ b/web/src/settings_bots.js @@ -68,7 +68,7 @@ export function render_bots() { name: elem.full_name, email: elem.email, user_id: elem.user_id, - type: settings_data.type_id_to_string(elem.bot_type), + type: settings_data.bot_type_id_to_string(elem.bot_type), avatar_url: elem.avatar_url, api_key: elem.api_key, is_active: elem.is_active, diff --git a/web/src/settings_data.ts b/web/src/settings_data.ts index 2334453999..2924eb1e00 100644 --- a/web/src/settings_data.ts +++ b/web/src/settings_data.ts @@ -254,7 +254,7 @@ export function user_email_not_configured(): boolean { return page_params.is_owner && page_params.delivery_email === ""; } -export function type_id_to_string(type_id: number): string | undefined { +export function bot_type_id_to_string(type_id: number): string | undefined { const bot_type = page_params.bot_types.find((bot_type) => bot_type.type_id === type_id); if (bot_type === undefined) { diff --git a/web/src/settings_users.js b/web/src/settings_users.js index 5571109e23..511d7b7c0e 100644 --- a/web/src/settings_users.js +++ b/web/src/settings_users.js @@ -237,7 +237,7 @@ function bot_info(bot_user_id) { info.user_role_text = people.get_user_type(bot_user_id); // Convert bot type id to string for viewing to the users. - info.bot_type = settings_data.type_id_to_string(bot_user.bot_type); + info.bot_type = settings_data.bot_type_id_to_string(bot_user.bot_type); info.bot_owner_full_name = bot_owner_full_name(owner_id); diff --git a/web/src/user_profile.js b/web/src/user_profile.js index c7e139a4cc..2221b1ffad 100644 --- a/web/src/user_profile.js +++ b/web/src/user_profile.js @@ -349,7 +349,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") { const bot_owner = people.get_by_user_id(bot_owner_id); args.bot_owner = bot_owner; } - args.bot_type = settings_data.type_id_to_string(user.bot_type); + args.bot_type = settings_data.bot_type_id_to_string(user.bot_type); } $("#user-profile-modal-holder").html(render_user_profile_modal(args)); diff --git a/web/tests/settings_data.test.js b/web/tests/settings_data.test.js index 5420a78289..5442951f95 100644 --- a/web/tests/settings_data.test.js +++ b/web/tests/settings_data.test.js @@ -419,7 +419,7 @@ run_test("type_id_to_string", () => { }, ]; - assert.equal(settings_data.type_id_to_string(1), "Generic bot"); - assert.equal(settings_data.type_id_to_string(2), "Incoming webhook"); - assert.equal(settings_data.type_id_to_string(5), undefined); + assert.equal(settings_data.bot_type_id_to_string(1), "Generic bot"); + assert.equal(settings_data.bot_type_id_to_string(2), "Incoming webhook"); + assert.equal(settings_data.bot_type_id_to_string(5), undefined); });