From 1d9da3aecd522bd4fbc4cb73d1734fdd1c8f150c Mon Sep 17 00:00:00 2001 From: Maneesh Shukla Date: Wed, 20 Aug 2025 23:06:00 +0530 Subject: [PATCH] settings: Add common user-or-bot-settings-section class. This class is added so that we can avoid duplicating code and use common functions for users and bots tables. This commit also updates the name of the function handling clear button in search input so that it can be used for bots as well in further commits. --- web/src/settings_users.ts | 12 ++++++------ web/templates/settings/active_user_list_admin.hbs | 2 +- web/templates/settings/bot_list_admin.hbs | 2 +- web/templates/settings/deactivated_users_admin.hbs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/src/settings_users.ts b/web/src/settings_users.ts index 6a0e3a6fc0..4325d65376 100644 --- a/web/src/settings_users.ts +++ b/web/src/settings_users.ts @@ -470,7 +470,7 @@ function human_info(person: User): { } function set_text_search_value($table: JQuery, value: string): void { - $table.closest(".user-settings-section").find(".search").val(value); + $table.closest(".user-or-bot-settings-section").find(".search").val(value); } let bot_list_widget: ListWidgetType; @@ -550,8 +550,8 @@ function active_create_table(active_users: number[]): void { $("#admin_users_table").show(); } -function handle_clear_button_for_users($tbody: JQuery): void { - const $container = $tbody.closest(".user-settings-section"); +function handle_clear_button_for_table_search_input($tbody: JQuery): void { + const $container = $tbody.closest(".user-or-bot-settings-section"); $container.on("click", ".clear-filter", (e) => { e.stopPropagation(); e.preventDefault(); @@ -783,7 +783,7 @@ function handle_filter_change($tbody: JQuery, section: UserSettingsSection): voi // can't use that, because we're also filtering on Role with our // custom predicate. $tbody - .closest(".user-settings-section") + .closest(".user-or-bot-settings-section") .find(".search") .on("input.list_widget_filter", function (this: HTMLInputElement) { add_value_to_filters(section, "text_search", this.value.toLocaleLowerCase()); @@ -797,7 +797,7 @@ function active_handle_events(): void { handle_deactivation($tbody); handle_reactivation($tbody); handle_edit_form($tbody); - handle_clear_button_for_users($tbody); + handle_clear_button_for_table_search_input($tbody); } function deactivated_handle_events(): void { @@ -807,7 +807,7 @@ function deactivated_handle_events(): void { handle_deactivation($tbody); handle_reactivation($tbody); handle_edit_form($tbody); - handle_clear_button_for_users($tbody); + handle_clear_button_for_table_search_input($tbody); } function bots_handle_events(): void { diff --git a/web/templates/settings/active_user_list_admin.hbs b/web/templates/settings/active_user_list_admin.hbs index 4bc9387a63..b979b7443b 100644 --- a/web/templates/settings/active_user_list_admin.hbs +++ b/web/templates/settings/active_user_list_admin.hbs @@ -1,4 +1,4 @@ -