From efc6c70d3bfa58b28672f015a16f0250e33d185c Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Tue, 15 Oct 2024 16:35:34 +0200 Subject: [PATCH] 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. --- web/src/typing.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/typing.ts b/web/src/typing.ts index 1ef4e770e8..8a9f6a4402 100644 --- a/web/src/typing.ts +++ b/web/src/typing.ts @@ -111,10 +111,15 @@ function notify_server_stop(to: Recipient): void { export function get_recipient(): Recipient | null { const message_type = compose_state.get_message_type(); 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 { message_type: "direct", notification_event_type: "typing", - ids: get_user_ids_array()!, + ids: user_ids, }; } if (message_type === "stream") {