settings_user: Don't render bot_owner_select for user list.

This optimize the case when the user-info-form modal is opened
in user-list by not rendering bot_owner_select handlebar.
This bug is before changing form to modal.
This commit is contained in:
Shubham Dhama
2018-07-30 13:00:51 +05:30
committed by Tim Abbott
parent 8f115c8291
commit 4186ebe56a

View File

@@ -359,7 +359,6 @@ exports.on_load_success = function (realm_people_data) {
}); });
function open_user_info_form_modal(user_id, is_bot) { function open_user_info_form_modal(user_id, is_bot) {
var users_list = people.get_active_human_persons();
var html = templates.render('user-info-form-modal', { var html = templates.render('user-info-form-modal', {
user_id: user_id, user_id: user_id,
full_name: people.get_full_name(user_id), full_name: people.get_full_name(user_id),
@@ -370,14 +369,15 @@ exports.on_load_success = function (realm_people_data) {
modal_container.empty().append(user_info_form_modal); modal_container.empty().append(user_info_form_modal);
overlays.open_modal('user-info-form-modal'); overlays.open_modal('user-info-form-modal');
var owner_select = $(templates.render("bot_owner_select", {users_list: users_list}));
if (is_bot) { if (is_bot) {
// Dynamically add the owner select control in order to // Dynamically add the owner select control in order to
// avoid performance issues in case of large number of users. // avoid performance issues in case of large number of users.
var users_list = people.get_active_human_persons();
var owner_select = $(templates.render("bot_owner_select", {users_list: users_list}));
owner_select.val(bot_data.get(user_id).owner || ""); owner_select.val(bot_data.get(user_id).owner || "");
modal_container.find(".edit_bot_owner_container").append(owner_select); modal_container.find(".edit_bot_owner_container").append(owner_select);
} }
return user_info_form_modal; return user_info_form_modal;
} }