typing: Check for valid user IDs when setting typing recipient.

Before sending typing notifications to the server, make sure that
the user has set at least one valid user pill in the compose box
recipient bar.
This commit is contained in:
Lauryn Menard 2024-10-15 16:35:34 +02:00 committed by Tim Abbott
parent ad1d8a204f
commit efc6c70d3b
1 changed files with 6 additions and 1 deletions

View File

@ -111,10 +111,15 @@ function notify_server_stop(to: Recipient): void {
export function get_recipient(): Recipient | null { export function get_recipient(): Recipient | null {
const message_type = compose_state.get_message_type(); const message_type = compose_state.get_message_type();
if (message_type === "private") { if (message_type === "private") {
const user_ids = get_user_ids_array();
// compose box with no valid user pills.
if (user_ids === null) {
return null;
}
return { return {
message_type: "direct", message_type: "direct",
notification_event_type: "typing", notification_event_type: "typing",
ids: get_user_ids_array()!, ids: user_ids,
}; };
} }
if (message_type === "stream") { if (message_type === "stream") {