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.

user_groups: Add subgroups field to user group objects.

Sahil Batrae2b9d6ebeb92
diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js
index 971e15789ec..718dbd4178d 100644
--- a/frontend_tests/node_tests/composebox_typeahead.js
+++ b/frontend_tests/node_tests/composebox_typeahead.js
@@ -291,6 +291,7 @@ const hamletcharacters = {
description: "Characters of Hamlet",
members: new Set([100, 104]),
is_system_group: false,
+ subgroups: new Set([10, 11]),
};
const backend = {
@@ -299,6 +300,7 @@ const backend = {
description: "Backend team",
members: new Set([]),
is_system_group: false,
+ subgroups: new Set([]),
};
const call_center = {
@@ -307,6 +309,7 @@ const call_center = {
description: "folks working in support",
members: new Set([]),
is_system_group: false,
+ subgroups: new Set([]),
};
const make_emoji = (emoji_dict) => ({
diff --git a/frontend_tests/node_tests/user_groups.js b/frontend_tests/node_tests/user_groups.js
index 8fe7c29455b..661f1648f79 100644
--- a/frontend_tests/node_tests/user_groups.js
+++ b/frontend_tests/node_tests/user_groups.js
@@ -15,6 +15,7 @@ run_test("user_groups", () => {
id: 0,
members: new Set([1, 2]),
is_system_group: false,
+ subgroups: new Set([4, 5]),
};
const params = {};
@@ -31,12 +32,14 @@ run_test("user_groups", () => {
id: 1,
members: new Set([3]),
is_system_group: false,
+ subgroups: new Set([]),
};
const all = {
name: "Everyone",
id: 2,
members: new Set([1, 2, 3]),
is_system_group: false,
+ subgroups: new Set([4, 5, 6]),
};
user_groups.add(admins);
diff --git a/static/js/user_groups.ts b/static/js/user_groups.ts
index 0de90fcec35..e1cdd3f959c 100644
--- a/static/js/user_groups.ts
+++ b/static/js/user_groups.ts
@@ -8,6 +8,7 @@ type UserGroup = {
name: string;
members: Set<number>;
is_system_group: boolean;
+ subgroups: Set<number>;
};
// The members field is a number array which we convert
@@ -35,6 +36,7 @@ export function add(user_group_raw: UserGroupRaw): void {
name: user_group_raw.name,
members: new Set(user_group_raw.members),
is_system_group: user_group_raw.is_system_group,
+ subgroups: new Set(user_group_raw.subgroups),
};
user_group_name_dict.set(user_group.name, user_group);