From 6aa08b9c50721d005ba61a92439622f0c2114ae7 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Mon, 4 Nov 2024 22:14:56 -0800 Subject: [PATCH] settings_users: Remove unnecessary bot user undefined check. Users are fetched from `people_by_user_id_dict`. `bot_info` is only called from: * `bots_create_table`, with ids from `get_bot_ids` which are from this `people_by_user_id_dict`. * `update_bot_data`, which is called in two places that check `is_valid_bot_user` on the bot id first. So we should always get a `bot_user` back, and we're already relying on the bot users being defined in several methods of the `bot_list_widget`. --- web/src/settings_users.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/web/src/settings_users.js b/web/src/settings_users.js index 5e0f87cd0c..6e5da0eef8 100644 --- a/web/src/settings_users.js +++ b/web/src/settings_users.js @@ -220,12 +220,7 @@ function bot_owner_full_name(owner_id) { } function bot_info(bot_user_id) { - const bot_user = people.maybe_get_user_by_id(bot_user_id); - - if (!bot_user) { - return undefined; - } - + const bot_user = people.get_by_user_id(bot_user_id); const owner_id = bot_user.bot_owner_id; const info = {}; @@ -322,9 +317,6 @@ function bots_create_table() { filter: { $element: $bots_table.closest(".settings-section").find(".search"), predicate(item, value) { - if (!item) { - return false; - } return ( item.full_name.toLowerCase().includes(value) || item.display_email.toLowerCase().includes(value)