Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
muted_users: Hide muted typists in streams.
Dinesh61d30b7aef54
diff --git a/web/src/typing_data.ts b/web/src/typing_data.tsindex 284dd0af9e8..1ff81e2bddb 100644--- a/web/src/typing_data.ts+++ b/web/src/typing_data.ts@@ -60,7 +60,8 @@ export function get_all_direct_message_typists(): number[] {}export function get_topic_typists(stream_id: number, topic: string): number[] {- return typists_dict.get(get_topic_key(stream_id, topic)) ?? [];+ const typists = typists_dict.get(get_topic_key(stream_id, topic)) ?? [];+ return muted_users.filter_muted_user_ids(typists);}// The next functions aren't pure data, but it is easydiff --git a/web/tests/typing_data.test.js b/web/tests/typing_data.test.jsindex 391350ae7f3..f0214a4956a 100644--- a/web/tests/typing_data.test.js+++ b/web/tests/typing_data.test.js@@ -85,17 +85,26 @@ test("basics", () => {});test("muted_typists_excluded", () => {+ const stream_id = 1;+ const topic = "typing notifications";+ const topic_typing_key = typing_data.get_topic_key(stream_id, topic);+typing_data.add_typist(typing_data.get_direct_message_conversation_key([5, 10, 15]), 5);typing_data.add_typist(typing_data.get_direct_message_conversation_key([5, 10, 15]), 10);+ typing_data.add_typist(topic_typing_key, 7);+ typing_data.add_typist(topic_typing_key, 12);// Nobody is muted.assert.deepEqual(typing_data.get_group_typists([5, 10, 15]), [5, 10]);assert.deepEqual(typing_data.get_all_direct_message_typists(), [5, 10]);+ assert.deepEqual(typing_data.get_topic_typists(stream_id, topic), [7, 12]);// Mute a user, and test that the get_* functions exclude that user.muted_users.add_muted_user(10);+ muted_users.add_muted_user(7);assert.deepEqual(typing_data.get_group_typists([5, 10, 15]), [5]);assert.deepEqual(typing_data.get_all_direct_message_typists(), [5]);+ assert.deepEqual(typing_data.get_topic_typists(stream_id, topic), [12]);});test("timers", () => {