From caf919fca2f14e3e726664fab349c5c595ab1cb3 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Fri, 25 Oct 2024 19:00:00 +0530 Subject: [PATCH] user_groups: Don't allow adding deactivated groups as subgroups in UI. We already have the code to ignore the deactivated groups before sending the request and show appropriate message. This commit just adds code to not show them in the typeahead and also not create its pill if user types the full group name. --- web/src/user_groups.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/user_groups.ts b/web/src/user_groups.ts index 67978f2b95..fadaf54c42 100644 --- a/web/src/user_groups.ts +++ b/web/src/user_groups.ts @@ -318,6 +318,10 @@ export function check_group_can_be_subgroup( // This logic could be optimized if we maintained a reverse map // from each group to the groups containing it, which might be a // useful data structure for other code paths as well. + if (subgroup.deactivated) { + return false; + } + const already_subgroup_ids = target_user_group.direct_subgroup_ids; if (subgroup.id === target_user_group.id) { return false;