mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
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:
@@ -74,7 +74,7 @@ exports.reset_sections = function () {
|
|||||||
settings_profile_fields.reset();
|
settings_profile_fields.reset();
|
||||||
settings_streams.reset();
|
settings_streams.reset();
|
||||||
settings_user_groups.reset();
|
settings_user_groups.reset();
|
||||||
settings_users.reset();
|
// settings_users doesn't need a reset()
|
||||||
};
|
};
|
||||||
|
|
||||||
window.settings_sections = exports;
|
window.settings_sections = exports;
|
||||||
|
|||||||
@@ -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_human_form = require('../templates/admin_human_form.hbs');
|
||||||
const render_admin_bot_form = require('../templates/admin_bot_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 = {
|
const section = {
|
||||||
active: {},
|
active: {},
|
||||||
deactivated: {},
|
deactivated: {},
|
||||||
@@ -321,12 +313,12 @@ section.deactivated.create_table = (deactivated_users) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.update_user_data = function (user_id, new_data) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user_row = get_user_info_row(user_id);
|
|
||||||
|
|
||||||
if (new_data.full_name !== undefined) {
|
if (new_data.full_name !== undefined) {
|
||||||
// Update the full name in the table
|
// Update the full name in the table
|
||||||
user_row.find(".user_name").text(new_data.full_name);
|
user_row.find(".user_name").text(new_data.full_name);
|
||||||
@@ -370,7 +362,7 @@ function start_data_load() {
|
|||||||
url: '/json/users',
|
url: '/json/users',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
timeout: 10 * 1000,
|
timeout: 10 * 1000,
|
||||||
success: exports.on_load_success,
|
success: populate_users,
|
||||||
error: failed_listing_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 = () => {
|
section.active.handle_events = () => {
|
||||||
const tbody = $('#admin_users_table').expectOne();
|
const tbody = $('#admin_users_table').expectOne();
|
||||||
const status_field = $('#user-field-status').expectOne();
|
const status_field = $('#user-field-status').expectOne();
|
||||||
|
|||||||
Reference in New Issue
Block a user