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`.
This commit is contained in:
evykassirer 2024-11-04 22:14:56 -08:00 committed by Tim Abbott
parent 0e3374dc1b
commit 6aa08b9c50
1 changed files with 1 additions and 9 deletions

View File

@ -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)