Skip to content

Commit

Permalink
typing_notification: Notify server only if topic already exists.
Browse files Browse the repository at this point in the history
Sending this request wouldn't be of much use as we are
displaying notifications in a topic narrow for the recieving users.
They cannot be in a topic narrow that doesn't exist already for
them to benefit from these typing notifications.
  • Loading branch information
chdinesh1089 committed Mar 14, 2021
1 parent c46aad3 commit 81094e9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/js/typing.js
Expand Up @@ -7,6 +7,7 @@ import * as compose_pm_pill from "./compose_pm_pill";
import * as compose_state from "./compose_state";
import * as people from "./people";
import * as stream_data from "./stream_data";
import * as stream_topic_history from "./stream_topic_history";

// This module handles the outbound side of typing indicators.
// We detect changes in the compose box and notify the server
Expand Down Expand Up @@ -91,6 +92,9 @@ export function get_recipient() {
const stream_name = compose_state.stream_name();
const stream_id = stream_data.get_stream_id(stream_name);
const topic = compose_state.topic();
if (!stream_topic_history.get_recent_topic_names(stream_id).includes(topic)) {
return null; // Send notification only if topic already exists.
}
return {stream_id, topic};
}
return null;
Expand Down

0 comments on commit 81094e9

Please sign in to comment.