bot settings: Simplify code for bot owners.

This commit is contained in:
Steve Howell 2020-03-24 22:47:27 +00:00 committed by Tim Abbott
parent 58b72a2194
commit 4a78b54c53
1 changed files with 5 additions and 3 deletions

View File

@ -135,13 +135,15 @@ function populate_users(realm_people_data) {
// Convert bot type id to string for viewing to the users. // Convert bot type id to string for viewing to the users.
user.bot_type = settings_bots.type_id_to_string(user.bot_type); user.bot_type = settings_bots.type_id_to_string(user.bot_type);
if (user.bot_owner_id !== null) { const bot_owner = people.get_bot_owner_user(user);
user.bot_owner_full_name = people.get_by_user_id(
user.bot_owner_id).full_name; if (bot_owner) {
user.bot_owner_full_name = bot_owner.full_name;
} else { } else {
user.no_owner = true; user.no_owner = true;
user.bot_owner_full_name = i18n.t("No owner"); user.bot_owner_full_name = i18n.t("No owner");
} }
bots.push(user); bots.push(user);
} else if (user.is_active) { } else if (user.is_active) {
user.last_active = get_last_active(user); user.last_active = get_last_active(user);