diff --git a/tools/test-js-with-node b/tools/test-js-with-node index bb770bec1c..2da28e4b7f 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -175,7 +175,7 @@ EXEMPT_FILES = make_set( "web/src/settings_exports.ts", "web/src/settings_invites.js", "web/src/settings_linkifiers.js", - "web/src/settings_muted_users.js", + "web/src/settings_muted_users.ts", "web/src/settings_notifications.js", "web/src/settings_org.js", "web/src/settings_panel_menu.js", diff --git a/web/src/settings_muted_users.js b/web/src/settings_muted_users.ts similarity index 83% rename from web/src/settings_muted_users.js rename to web/src/settings_muted_users.ts index 7ef4227689..8fadfc0fa7 100644 --- a/web/src/settings_muted_users.js +++ b/web/src/settings_muted_users.ts @@ -9,16 +9,22 @@ import * as scroll_util from "./scroll_util"; export let loaded = false; -export function populate_list() { +type MutedUserItem = { + user_id: number; + user_name: string; + date_muted_str: string; +}; + +export function populate_list(): void { const all_muted_users = muted_users.get_muted_users().map((user) => ({ user_id: user.id, user_name: people.get_full_name(user.id), date_muted_str: user.date_muted_str, })); const $muted_users_table = $("#muted_users_table"); - const $search_input = $("#muted_users_search"); + const $search_input = $("input#muted_users_search"); - ListWidget.create($muted_users_table, all_muted_users, { + ListWidget.create($muted_users_table, all_muted_users, { name: "muted-users-list", get_item: ListWidget.default_get_item, modifier_html(muted_user) { @@ -44,11 +50,11 @@ export function populate_list() { }); } -export function set_up() { +export function set_up(): void { loaded = true; $("body").on("click", ".settings-unmute-user", function (e) { const $row = $(this).closest("tr"); - const user_id = Number.parseInt($row.attr("data-user-id"), 10); + const user_id = Number.parseInt($row.attr("data-user-id")!, 10); e.stopPropagation(); muted_users.unmute_user(user_id); @@ -57,6 +63,6 @@ export function set_up() { populate_list(); } -export function reset() { +export function reset(): void { loaded = false; }