Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Remove empty user groups from typeahead suggestion.

Pratik Chandafb0ae3120691
diff --git a/web/src/typeahead_helper.ts b/web/src/typeahead_helper.ts
index f4a9d8ce415..b03e18f8913 100644
--- a/web/src/typeahead_helper.ts
+++ b/web/src/typeahead_helper.ts
@@ -546,6 +546,10 @@ export let sort_recipients = <UserType extends UserOrMentionPillData | UserPillD
function add_group_recipients(items: UserGroupPillData[]): void {
for (const item of items) {
+ const is_empty_group = user_groups.is_empty_group(item.id);
+ if (is_empty_group) {
+ continue;
+ }
recipients.push(item);
}
}
diff --git a/web/tests/composebox_typeahead.test.cjs b/web/tests/composebox_typeahead.test.cjs
index 9ebded87559..5192b3697a7 100644
--- a/web/tests/composebox_typeahead.test.cjs
+++ b/web/tests/composebox_typeahead.test.cjs
@@ -490,6 +490,23 @@ const call_center = user_group_item({
deactivated: false,
});
+const support = user_group_item({
+ name: "support",
+ id: 4,
+ creator_id: null,
+ date_created: 1596710000,
+ description: "Support team",
+ members: new Set([]),
+ is_system_group: false,
+ direct_subgroup_ids: new Set([]),
+ can_add_members_group: 2,
+ can_join_group: 2,
+ can_leave_group: 2,
+ can_manage_group: 2,
+ can_mention_group: 2,
+ deactivated: false,
+});
+
const make_emoji = (emoji_dict) => ({
emoji_name: emoji_dict.name,
emoji_code: emoji_dict.emoji_code,
@@ -536,6 +553,7 @@ function test(label, f) {
user_groups.add(hamletcharacters);
user_groups.add(backend);
user_groups.add(call_center);
+ user_groups.add(support);
muted_users.set_muted_users([]);