group-settings: Live update membership status text on subgroup update.

This commit adds code to live update the membership status text
if subgroups of a group, either the active group or one of the
subgroup of active group.

Fixes #32485.
This commit is contained in:
Sahil Batra
2024-12-03 11:48:15 +05:30
committed by Tim Abbott
parent cbada036a9
commit 9be0eee446
2 changed files with 41 additions and 7 deletions

View File

@@ -434,6 +434,19 @@ export function is_user_in_group(
return false;
}
export function is_user_in_any_group(
user_group_ids: number[],
user_id: number,
direct_member_only = false,
): boolean {
for (const group_id of user_group_ids) {
if (is_user_in_group(group_id, user_id, direct_member_only)) {
return true;
}
}
return false;
}
export function get_associated_subgroups(user_group: UserGroup, user_id: number): UserGroup[] {
const subgroup_ids = get_recursive_subgroups(user_group)!;
if (subgroup_ids === undefined) {