typing: Use people.emails_string_to_user_ids for "dm" narrow term.

Updates the logic for getting the typists for a specific direct
message conversation to mirror narrow_state.set_compose_defaults
for the current filter's "dm" narrow term.
This commit is contained in:
Lauryn Menard
2025-09-24 18:02:04 +02:00
committed by Tim Abbott
parent c2d008aadb
commit 5d7adcbc00

View File

@@ -90,23 +90,16 @@ function get_users_typing_for_narrow(): number[] {
return []; return [];
} }
const terms = narrow_state.search_terms(); // Narrow has a filter with either "dm:" or "is:dm".
if (terms[0] === undefined) { const current_filter = narrow_state.filter()!;
return []; if (current_filter.has_operator("dm")) {
}
const first_term = terms[0];
if (first_term.operator === "dm") {
// Get list of users typing in this conversation // Get list of users typing in this conversation
const narrow_emails_string = first_term.operand; const narrow_emails_string = current_filter.operands("dm")[0]!;
// TODO: Create people.emails_strings_to_user_ids. if (!people.is_valid_bulk_emails_for_compose(narrow_emails_string.split(","))) {
const narrow_user_ids_string = people.reply_to_to_user_ids_string(narrow_emails_string); // Narrowed to an invalid direct message recipient.
if (!narrow_user_ids_string) {
return []; return [];
} }
const narrow_user_ids = narrow_user_ids_string const narrow_user_ids = people.emails_string_to_user_ids(narrow_emails_string);
.split(",")
.map((user_id_string) => Number.parseInt(user_id_string, 10));
const group = [...narrow_user_ids, current_user.user_id]; const group = [...narrow_user_ids, current_user.user_id];
return typing_data.get_group_typists(group); return typing_data.get_group_typists(group);
} }