From 1d087ebefe948db555963a7bfaeb527e465c6aa0 Mon Sep 17 00:00:00 2001 From: Linty Date: Wed, 16 Oct 2024 15:18:05 +0200 Subject: [PATCH] fixes #2158 refactor user data assignment ...with spread operator for cleaner code. This change also allows for compatibility with additional fields that may be returned by the API, such as those added by plugins, ensuring all elements are captured without explicitly defining each one. --- admin/themes/default/js/user_list.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/admin/themes/default/js/user_list.js b/admin/themes/default/js/user_list.js index 35acf17ff..6a53df34d 100644 --- a/admin/themes/default/js/user_list.js +++ b/admin/themes/default/js/user_list.js @@ -1944,18 +1944,7 @@ function update_user_info() { if (data.stat === 'ok') { let result_user = data.result.users[0]; if (last_user_index != -1) { - current_users[last_user_index].email = result_user.email; - current_users[last_user_index].enabled_high = result_user.enabled_high; - current_users[last_user_index].expand = result_user.expand; - current_users[last_user_index].groups = result_user.groups; - current_users[last_user_index].language = result_user.language; - current_users[last_user_index].level = result_user.level; - current_users[last_user_index].nb_image_page = result_user.nb_image_page; - current_users[last_user_index].recent_period = result_user.recent_period; - current_users[last_user_index].show_nb_comments = result_user.show_nb_comments; - current_users[last_user_index].show_nb_hits = result_user.show_nb_hits; - current_users[last_user_index].status = result_user.status; - current_users[last_user_index].theme = result_user.theme; + current_users[last_user_index] = {...current_users[last_user_index], ...result_user}; fill_container_user_info($('#user-table-content .user-container').eq(last_user_index), last_user_index); } $("#UserList .update-user-success").fadeIn().delay(1500).fadeOut(2500);