user settings: Remove reset/meta.loaded logic.

We don't really need to know whether we've loaded
the user-related panels, since we only used `meta.loaded`
for a tiny optimization to avoid a jQuery lookup.

We rely mostly on the list widgets from `list_render`,
and they are smart enough to repopulate themselves
when they're called subsequent times.
This commit is contained in:
Steve Howell
2020-05-09 18:20:26 +00:00
committed by Tim Abbott
parent 155f6da8ba
commit cea6214ce8
2 changed files with 5 additions and 19 deletions

View File

@@ -4,14 +4,6 @@ const render_bot_owner_select = require("../templates/bot_owner_select.hbs");
const render_admin_human_form = require('../templates/admin_human_form.hbs');
const render_admin_bot_form = require('../templates/admin_bot_form.hbs');
const meta = {
loaded: false,
};
exports.reset = function () {
meta.loaded = false;
};
const section = {
active: {},
deactivated: {},
@@ -321,12 +313,12 @@ section.deactivated.create_table = (deactivated_users) => {
};
exports.update_user_data = function (user_id, new_data) {
if (!meta.loaded) {
const user_row = get_user_info_row(user_id);
if (user_row.length === 0) {
return;
}
const user_row = get_user_info_row(user_id);
if (new_data.full_name !== undefined) {
// Update the full name in the table
user_row.find(".user_name").text(new_data.full_name);
@@ -370,7 +362,7 @@ function start_data_load() {
url: '/json/users',
idempotent: true,
timeout: 10 * 1000,
success: exports.on_load_success,
success: populate_users,
error: failed_listing_users,
});
}
@@ -634,12 +626,6 @@ function handle_bot_form(tbody, status_field) {
});
}
exports.on_load_success = function (realm_people_data) {
meta.loaded = true;
populate_users(realm_people_data);
};
section.active.handle_events = () => {
const tbody = $('#admin_users_table').expectOne();
const status_field = $('#user-field-status').expectOne();