typing: Fix "Missing stream_id" server error.

This commit fixes an error where composing a message with
no stream selected resulted in making a POST request to
'/typing' with stream_id as undefined which resulted in
a "Missing server_id" error.

We no longer make a POST request if the stream is not
selected.
This commit is contained in:
Prakhar Pratyush 2024-02-23 02:11:16 +05:30 committed by Tim Abbott
parent 1a5c475910
commit f023a11d01
1 changed files with 5 additions and 1 deletions

View File

@ -119,7 +119,11 @@ export function get_recipient(): Recipient | null {
}
if (message_type === "stream") {
const stream_name = compose_state.stream_name();
const stream_id = stream_data.get_stream_id(stream_name)!;
const stream_id = stream_data.get_stream_id(stream_name);
if (stream_id === undefined) {
// compose box with no stream selected.
return null;
}
const topic = compose_state.topic();
return {
message_type: "stream",