user_groups: Add subgroups field to user group objects.

This commit is contained in:
Sahil Batra 2022-05-02 12:46:32 +05:30 committed by Tim Abbott
parent 2c11824cc2
commit e2b9d6ebeb
3 changed files with 8 additions and 0 deletions

View File

@ -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) => ({

View File

@ -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);

View File

@ -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);